Fiz vários passos que passaram mas nada resolveu. No final as coisas estão assim
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.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/4.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/'
![]( )
Erro que da quando tento coletar os arquivos estáticos. Já tentei mudar as permissões no AWS mas não deu certo, creio que seja alguma coisa do aws e nao do codigo
ATUALIZAÇAO:
Eu consigo subir arquivos usando a biblioteca do boto3 e tambem solicitar dados que estão no bucket mas não consigo fazer o upload da pasta nem o colecstatic