问题
When I am serving static files from AWS S3 using the {%static %} template I get this type of url: https://elasticbeanstalk-eu-west-1-2548513.s3.amazonaws.com/css/7aa4edf0c543.css?Signature=lpSpJuyv55JwkjxGKnNVmfn5QKs%3D&Expires=1370880855&AWSAccessKeyId=AKIAIDOQ45S6OQCXGNYQ
Well the signature changes everytime. So when I am using django_storages with offline compression the key for that file is changing everytime because its name is changing so I get the error: You have offline compression enabled but key "4c18774209c3d10bb81ec7f466b17e21" is missing from offline manifest. You may need to run "python manage.py compress".
If instead of using the {%static %} template I use a constant URL this error doesn't happens..
Why does the aws s3 has that kind of URL ? Whats the point of the signature and the Expires parameters? I changed my aws s3 configuration to send expires header and cache-control for 1 year, however the expires from the url is just one hour.
回答1:
Try adding this to your settings.
It should stop the get params being added to the url.
AWS_QUERYSTRING_AUTH = False
来源:https://stackoverflow.com/questions/17027343/aws-s3-url-changing-dynamically-with-django-statics