Ja tentei diversos metodos para solucionar este problema porem nenhum ate agora funcionou.
# AWS Configuracao
AWS_ACCESS_KEY_ID = str(os.getenv('AWS_ACCESS_KEY_ID'))
AWS_SECRET_ACCESS_KEY = str(os.getenv('AWS_SECRET_ACCESS_KEY'))
AWS_STORAGE_BUCKET_NAME = str(os.getenv('AWS_STORAGE_BUCKET_NAME'))
AWS_S3_CUSTOM_DOMAIN = f'{AWS_STORAGE_BUCKET_NAME}.s3.sa-east-1.console.amazonaws.com'
AWS_DEFAULT_ACL = 'public-read'
AWS_S3_OBJECT_PARAMETERS = {
'CacheControl': 'max-age=86400'
}
AWS_LOCATION = 'static'
AWS_QUERYSTRING_AUTH = False
AWS_HEADERS = {
'Access-Control-Allow-Origin': '*',
}
STORAGES = {
"default": {
"BACKEND": "storages.backends.s3.S3Storage",
"OPTIONS": {
"access_key": str(os.getenv('AWS_ACCESS_KEY_ID')),
"secret_key": str(os.getenv('AWS_SECRET_ACCESS_KEY')),
"bucket_name": str(os.getenv('AWS_STORAGE_BUCKET_NAME'))
},
},
"staticfiles": {
"BACKEND": "storages.backends.s3.S3Storage",
"OPTIONS": {
"access_key": str(os.getenv('AWS_ACCESS_KEY_ID')),
"secret_key": str(os.getenv('AWS_SECRET_ACCESS_KEY')),
"bucket_name": str(os.getenv('AWS_STORAGE_BUCKET_NAME'))
},
},
}
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/5.1/howto/static-files/
STATIC_URL = f'https://{AWS_S3_CUSTOM_DOMAIN}/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'setup/static')
]
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
#Media
MEDIA_ROOT = os.path.join(BASE_DIR, "media")
MEDIA_URL = f'https://{AWS_S3_CUSTOM_DOMAIN}/media/'