From 2cf6c77d097e5bfbb430cd279d849f35906a8261 Mon Sep 17 00:00:00 2001 From: Daniel Muckerman Date: Sat, 12 Dec 2020 23:36:26 -0500 Subject: [PATCH] Add cache buster --- accounts/__init__.py | 9 ++++++--- accounts/auth/views.py | 2 +- requirements.txt | 3 ++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/accounts/__init__.py b/accounts/__init__.py index 9804e55..43388ba 100644 --- a/accounts/__init__.py +++ b/accounts/__init__.py @@ -3,7 +3,7 @@ from flask import Flask from flask_sqlalchemy import SQLAlchemy from flask_login import LoginManager, login_manager from flask_bootstrap import Bootstrap -from flask_simpleldap import LDAP +from flask_cachebuster import CacheBuster import os @@ -35,12 +35,15 @@ app.config['REMEMBER_COOKIE_DOMAIN'] = os.environ.get('COOKIE_DOMAIN') db = SQLAlchemy(app) -ldap = LDAP(app) - login_manager = LoginManager(app) login_manager.init_app(app) login_manager.login_view = 'auth.login' +config = {"extensions": [".js", ".css", ".csv"], "hash_size": 5} + +cache_buster = CacheBuster(config=config) +cache_buster.init_app(app) + from accounts.auth.views import auth app.register_blueprint(auth) diff --git a/accounts/auth/views.py b/accounts/auth/views.py index 942be83..abba04d 100644 --- a/accounts/auth/views.py +++ b/accounts/auth/views.py @@ -4,7 +4,7 @@ from flask_login import current_user, login_user, \ logout_user, login_required from ldap3 import MODIFY_REPLACE from ldap3.core.exceptions import LDAPBindError -from accounts import login_manager, db, ldap +from accounts import login_manager, db from accounts.auth.models import User, LoginForm, get_ldap_connection from email_validator import validate_email, EmailNotValidError diff --git a/requirements.txt b/requirements.txt index 51f5f3d..5063c34 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,4 +6,5 @@ python-ldap==3.2.0 ldap3==2.8.1 email-validator==1.1.1 Flask-SQLAlchemy==2.4.4 -Flask-WTF==0.14.3 \ No newline at end of file +Flask-WTF==0.14.3 +Flask-CacheBuster==1.0.0 \ No newline at end of file