Browse Source

Add cache buster

mistress
Daniel Muckerman 3 years ago
parent
commit
2cf6c77d09
3 changed files with 9 additions and 5 deletions
  1. +6
    -3
      accounts/__init__.py
  2. +1
    -1
      accounts/auth/views.py
  3. +2
    -1
      requirements.txt

+ 6
- 3
accounts/__init__.py View File

@ -3,7 +3,7 @@ from flask import Flask
from flask_sqlalchemy import SQLAlchemy from flask_sqlalchemy import SQLAlchemy
from flask_login import LoginManager, login_manager from flask_login import LoginManager, login_manager
from flask_bootstrap import Bootstrap from flask_bootstrap import Bootstrap
from flask_simpleldap import LDAP
from flask_cachebuster import CacheBuster
import os import os
@ -35,12 +35,15 @@ app.config['REMEMBER_COOKIE_DOMAIN'] = os.environ.get('COOKIE_DOMAIN')
db = SQLAlchemy(app) db = SQLAlchemy(app)
ldap = LDAP(app)
login_manager = LoginManager(app) login_manager = LoginManager(app)
login_manager.init_app(app) login_manager.init_app(app)
login_manager.login_view = 'auth.login' 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 from accounts.auth.views import auth
app.register_blueprint(auth) app.register_blueprint(auth)

+ 1
- 1
accounts/auth/views.py View File

@ -4,7 +4,7 @@ from flask_login import current_user, login_user, \
logout_user, login_required logout_user, login_required
from ldap3 import MODIFY_REPLACE from ldap3 import MODIFY_REPLACE
from ldap3.core.exceptions import LDAPBindError 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 accounts.auth.models import User, LoginForm, get_ldap_connection
from email_validator import validate_email, EmailNotValidError from email_validator import validate_email, EmailNotValidError

+ 2
- 1
requirements.txt View File

@ -6,4 +6,5 @@ python-ldap==3.2.0
ldap3==2.8.1 ldap3==2.8.1
email-validator==1.1.1 email-validator==1.1.1
Flask-SQLAlchemy==2.4.4 Flask-SQLAlchemy==2.4.4
Flask-WTF==0.14.3
Flask-WTF==0.14.3
Flask-CacheBuster==1.0.0

Loading…
Cancel
Save