From 9ebda4e38b53a91fe4204d2da0941fa0ec3dc9bd Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Mon, 1 Nov 2021 16:04:25 -0700 Subject: [PATCH] Add BROWSER_CACHE_DURATION constant. --- frontends/ycdl_flask/backend/common.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontends/ycdl_flask/backend/common.py b/frontends/ycdl_flask/backend/common.py index 2a57a05..c522bfd 100644 --- a/frontends/ycdl_flask/backend/common.py +++ b/frontends/ycdl_flask/backend/common.py @@ -18,11 +18,14 @@ from . import jinja_filters # Flask init ####################################################################################### +# __file__ = .../ycdl_flask/backend/common.py +# root_dir = .../ycdl_flask root_dir = pathclass.Path(__file__).parent.parent TEMPLATE_DIR = root_dir.with_child('templates') STATIC_DIR = root_dir.with_child('static') FAVICON_PATH = STATIC_DIR.with_child('favicon.png') +BROWSER_CACHE_DURATION = 180 site = flask.Flask( __name__, @@ -30,7 +33,7 @@ site = flask.Flask( static_folder=STATIC_DIR.absolute_path, ) site.config.update( - SEND_FILE_MAX_AGE_DEFAULT=180, + SEND_FILE_MAX_AGE_DEFAULT=BROWSER_CACHE_DURATION, TEMPLATES_AUTO_RELOAD=True, ) site.jinja_env.add_extension('jinja2.ext.do')