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).
This commit is contained in:
Chris Hill-Scott
2016-02-10 16:07:10 +00:00
parent 2f0cc99610
commit fc09750662

View File

@@ -5,6 +5,7 @@ class Config(object):
DEBUG = False DEBUG = False
ASSETS_DEBUG = False ASSETS_DEBUG = False
cache = False cache = False
SEND_FILE_MAX_AGE_DEFAULT = 365 * 24 * 60 * 60 # 1 year
manifest = True manifest = True
NOTIFY_LOG_LEVEL = 'DEBUG' NOTIFY_LOG_LEVEL = 'DEBUG'