From fc09750662bf72c707db4cf2ca748e620b47d2af Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Wed, 10 Feb 2016 16:07:10 +0000 Subject: [PATCH] Cache static files for a year We only want static files to not come from the browser cache when they have changed. The best way to do this is by cache busting the URLs. Otherwise, we want static files to be cached for a long time. This commit sets the `Expires` HTTP header to 1 year in the future. Previously it was set to 12 hours, the default. From the Flask docs: > Default cache control max age to use with send_static_file() (the default > static file handler) and send_file(), in seconds. Override this value on a > per-file basis using the get_send_file_max_age() hook on Flask or Blueprint, > respectively. Defaults to 43200 (12 hours). --- config.py | 1 + 1 file changed, 1 insertion(+) diff --git a/config.py b/config.py index 55ef41723..bc1ae87db 100644 --- a/config.py +++ b/config.py @@ -5,6 +5,7 @@ class Config(object): DEBUG = False ASSETS_DEBUG = False cache = False + SEND_FILE_MAX_AGE_DEFAULT = 365 * 24 * 60 * 60 # 1 year manifest = True NOTIFY_LOG_LEVEL = 'DEBUG'