I try to host Django Static and Media files on Amazon S3 and I follow every guide there, but I still get S3ResponseError: 301 Moved Permanently errors when deploying my Elastic Beanstalk application when it tries to execute collectstatic .
My S3 works, and I can access other files on it. I also installed it in a user domain so that you can access the same file in the following ways:
This is the third option that I want to use, but I have tried others. Both with and without https:// in the settings below.
My settings file is as follows
#settings.py file AWS_ACCESS_KEY_ID = 'XXX' AWS_SECRET_ACCESS_KEY = 'XXX' AWS_HEADERS = { 'Expires': 'Thu, 31 Dec 2099 20:00:00 GMT', 'Cache-Control': 'max-age=94608000', } AWS_STORAGE_BUCKET_NAME = 's3.condopilot.com'
I have AWS_S3_CALLING_FORMAT = 'boto.s3.connection.OrdinaryCallingFormat' because without it I get the following error: ssl.CertificateError: hostname 's3.condopilot.com.s3.amazonaws.com' doesn't match either of '*.s3.amazonaws.com', 's3.amazonaws.com' . All the tips I find on the Internet regarding this error say that OrdinaryCallingFormat should be used when the bucket name contains s3.condopilot.com , for example s3.condopilot.com .
My user repositories look like
And yes, my S3 bucket is configured in eu-west-1 .
source share