AWS S3 Config for Django

PHOTO EMBED

Mon Oct 04 2021 19:48:40 GMT+0000 (UTC)

Saved by @adk000 #django #aws #awss3

AWS_ACCESS_KEY_ID = your_access_key_id
AWS_SECRET_ACCESS_KEY = your_secret_access_key
AWS_STORAGE_BUCKET_NAME = 'sibtc-static'
AWS_S3_CUSTOM_DOMAIN = '%s.s3.amazonaws.com' % AWS_STORAGE_BUCKET_NAME
AWS_S3_OBJECT_PARAMETERS = {
    'CacheControl': 'max-age=86400',
}
AWS_LOCATION = 'static'
  
STATIC_URL = 'https://%s/%s/' % (AWS_S3_CUSTOM_DOMAIN, AWS_LOCATION)
STATICFILES_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage
content_copyCOPY

settings.py

https://stackabuse.com/serving-static-files-in-python-with-django-aws-s3-and-whitenoise/