Tell browsers not to re-fetch static assets

Since we version our asset filenames there’s no need for a browser to
ever fetch the same file twice. It should always cache fetch from its
own cache.

The accepted way to effect this behaviour is using the expires header,
which is what this argument to `WhiteNoise` does.
This commit is contained in:
Chris Hill-Scott
2018-11-29 12:02:18 +00:00
parent d58c04d974
commit d47e0482d4

View File

@@ -12,4 +12,4 @@ STATIC_URL = 'static/'
app = Flask('app')
create_app(app)
app.wsgi_app = WhiteNoise(app.wsgi_app, STATIC_ROOT, STATIC_URL)
app.wsgi_app = WhiteNoise(app.wsgi_app, STATIC_ROOT, STATIC_URL, max_age=WhiteNoise.FOREVER)