0

I've set up the settings as follows:

STATIC_ROOT = BASE_DIR + '/static'

YOUR_S3_BUCKET = "tlot-static"

# DEFAULT_FILE_STORAGE = "django_s3_storage.storage.S3Storage"
STATICFILES_STORAGE = "django_s3_storage.storage.StaticS3Storage"
AWS_S3_BUCKET_NAME = AWS_S3_BUCKET_NAME_STATIC = YOUR_S3_BUCKET

# These next two lines will serve the static files directly
# from the s3 bucket
AWS_S3_CUSTOM_DOMAIN = '%s.s3.amazonaws.com' % YOUR_S3_BUCKET
STATIC_URL = "https://%s/" % AWS_S3_CUSTOM_DOMAIN

but I keep getting:

<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>9F85922419DD93C0</RequestId><HostId>5lV1ft+jAOTvnqCvOC/fMSolHXS8foJde8XP1LxtYytlZLjejA2gvjIurYwt9Fn8Jxlgvy5IjOI=</HostId></Error>

The files was deployed successfully with collectstatic, and I've set up the cors as per the docs on the bucket. What else do I need to do?

Tjorriemorrie
  • 16,818
  • 20
  • 89
  • 131

1 Answers1

2

You need to either grant public access to the file or folder in your s3 settings (fastest way) on Amazon, or set up security policies if you need more strict access.

Maybe this link could help: https://www.codingforentrepreneurs.com/blog/s3-static-media-files-for-django/

Igor Belkov
  • 446
  • 3
  • 8