-1

how can I address the bucket using the correct endpoint? I'm using Django to create my app.

I've seen a solution for this in a different language and I couldn't understand a thing, is there a solution for Python?

settings.py

STATIC_URL = '/static/'

MEDIA_ROOT =  os.path.join(BASE_DIR, 'static') 
MEDIA_URL = '/media/'

AWS_ACCESS_KEY_ID = '****************'
AWS_SECRET_ACCESS_KEY = '*******************'
AWS_STORAGE_BUCKET_NAME = '*************+'

AWS_S3_FILE_OVERWRITE = False
AWS_DEFAULT_ACL = None
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'

The images url starts like this: https://s3.amazonaws.com/nostalg.ia/media/(...)

When it should start with the image destination like I see in all tutorials.

1 Answers1

1

You need to use regional endpoint to make your requests. The general syntax of a Regional endpoint is as follows:

protocol://service-code.region-code.amazonaws.com

For example:

https://mybucket.s3-ap-southeast-2.amazonaws.com/
Asri Badlah
  • 1,949
  • 1
  • 9
  • 20