DEV Community

Tolgahan ÜZÜN
Tolgahan ÜZÜN

Posted on

Create Your Own S3 Service For Your Django Project

There are many projects with which you can install replica of Amazon S3 service in local environment. I am using the project named S3 Ninja from these. Let me tell you how to make an S3 replica with simple steps.

S3 Ninja

Installation and Run Serve.

docker pull scireum/s3-ninja:4
docker run -p 9444:80 scireum/s3-ninja:4

I assume you have no problems and the installation is complete!

Create a Bucket

This was so easy!

Codes to add settings for Django

You must install this package and add it to the app list. django-storages

DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
AWS_ACCESS_KEY_ID = ‘access_key_id’
AWS_SECRET_ACCESS_KEY = ‘secret_access_key’
AWS_STORAGE_BUCKET_NAME = 'Bucket'
AWS_S3_ENDPOINT_URL = 'http://localhost:9444/s3/'

And action

Upload an image in the project. You need to do this using from django.core.files.storage import default_storage. Now your installation process will serve your own S3 service.

Top comments (0)