0
votes

I am having problems using an s3 bucket for my sites static files. Currently using django-storages and boto3.

In my setting.py I have:

AWS_ACCESS_KEY_ID = env("AWS_ACCESS_KEY_ID")
AWS_SECRET_ACCESS_KEY = env("AWS_SECRET_ACCESS_KEY")
AWS_STORAGE_BUCKET_NAME = env("AWS_STORAGE_BUCKET_NAME")
AWS_S3_FILE_OVERWITE = False
AWS_DEFAULT_ACL = None
AWS_S3_CUSTOM_DOMAIN = f'{AWS_STORAGE_BUCKET_NAME}.s3.amazonaws.com'
AWS_LOCATION = 'static'
STATIC_URL = f'https://{AWS_S3_CUSTOM_DOMAIN}/{AWS_LOCATION}/'
STATICFILES_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'

Running collectstatic sends static files to the s3 bucket successfully, but the static urls in my templates do not update.

I am using apache2 and have not changed the .conf file, do I need to?

Any help would be gratefully recieved

1
stackoverflow.com/questions/43529912/… This was what was causing my issue.user3809788

1 Answers

0
votes

When you say but the static urls in my templates do not update. what did you meant by that, can you try printing the static_url in settings and see if you are getting url what you are expecting, and can you share your template where you are accessing this.