mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-04-25 10:53:45 +03:00
Add cache control via AWS_S3_OBJECT_PARAMETERS setting
Previously covered by AWS_HEADERS
This commit is contained in:
parent
9661ecaf8f
commit
bef1bb856e
|
@ -100,6 +100,17 @@ AWS_STORAGE_BUCKET_NAME = env('DJANGO_AWS_STORAGE_BUCKET_NAME')
|
||||||
AWS_AUTO_CREATE_BUCKET = True
|
AWS_AUTO_CREATE_BUCKET = True
|
||||||
AWS_QUERYSTRING_AUTH = False
|
AWS_QUERYSTRING_AUTH = False
|
||||||
|
|
||||||
|
# AWS cache settings, don't change unless you know what you're doing:
|
||||||
|
AWS_EXPIRY = 60 * 60 * 24 * 7
|
||||||
|
|
||||||
|
# TODO See: https://github.com/jschneier/django-storages/issues/47
|
||||||
|
# Revert the following and use str after the above-mentioned bug is fixed in
|
||||||
|
# either django-storage-redux or boto
|
||||||
|
control = 'max-age=%d, s-maxage=%d, must-revalidate' % (AWS_EXPIRY, AWS_EXPIRY)
|
||||||
|
AWS_S3_OBJECT_PARAMETERS = {
|
||||||
|
'CacheControl': bytes(control, encoding='latin-1'),
|
||||||
|
}
|
||||||
|
|
||||||
# URL that handles the media served from MEDIA_ROOT, used for managing
|
# URL that handles the media served from MEDIA_ROOT, used for managing
|
||||||
# stored files.
|
# stored files.
|
||||||
{% if cookiecutter.use_whitenoise == 'y' -%}
|
{% if cookiecutter.use_whitenoise == 'y' -%}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user