From 9661ecaf8feb7c9a615199f044f8d469df2c3340 Mon Sep 17 00:00:00 2001 From: Sander van Leeuwen Date: Wed, 25 Oct 2017 14:11:36 +0200 Subject: [PATCH 1/2] Remove boto related settings that aren't used Since upgrade to boto3 in commit 12db5176d6c4c we don't need AWS_HEADERS anymore --- .../config/settings/production.py | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/{{cookiecutter.project_slug}}/config/settings/production.py b/{{cookiecutter.project_slug}}/config/settings/production.py index cc518644..b332c776 100644 --- a/{{cookiecutter.project_slug}}/config/settings/production.py +++ b/{{cookiecutter.project_slug}}/config/settings/production.py @@ -100,17 +100,6 @@ AWS_STORAGE_BUCKET_NAME = env('DJANGO_AWS_STORAGE_BUCKET_NAME') AWS_AUTO_CREATE_BUCKET = True 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_HEADERS = { - 'Cache-Control': bytes(control, encoding='latin-1') -} - # URL that handles the media served from MEDIA_ROOT, used for managing # stored files. {% if cookiecutter.use_whitenoise == 'y' -%} From bef1bb856e8434984ef4201b9ba28ee0936ce5c0 Mon Sep 17 00:00:00 2001 From: Sander van Leeuwen Date: Tue, 13 Feb 2018 16:04:43 +0100 Subject: [PATCH 2/2] Add cache control via AWS_S3_OBJECT_PARAMETERS setting Previously covered by AWS_HEADERS --- .../config/settings/production.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/{{cookiecutter.project_slug}}/config/settings/production.py b/{{cookiecutter.project_slug}}/config/settings/production.py index b332c776..32739837 100644 --- a/{{cookiecutter.project_slug}}/config/settings/production.py +++ b/{{cookiecutter.project_slug}}/config/settings/production.py @@ -100,6 +100,17 @@ AWS_STORAGE_BUCKET_NAME = env('DJANGO_AWS_STORAGE_BUCKET_NAME') AWS_AUTO_CREATE_BUCKET = True 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 # stored files. {% if cookiecutter.use_whitenoise == 'y' -%}