Switch to server-side sessions in redis

master
Florent Daigniere 4 years ago
parent 7e2db9c9c3
commit 22af5b8432

@ -1,5 +1,8 @@
import flask import flask
import flask_bootstrap import flask_bootstrap
import redis
from flask_kvsession import KVSessionExtension
from simplekv.memory.redisstore import RedisStore
from mailu import utils, debug, models, manage, configuration from mailu import utils, debug, models, manage, configuration
@ -17,6 +20,7 @@ def create_app_from_config(config):
# Initialize application extensions # Initialize application extensions
config.init_app(app) config.init_app(app)
models.db.init_app(app) models.db.init_app(app)
KVSessionExtension(RedisStore(redis.StrictRedis().from_url('redis://{0}/3'.format(config['REDIS_ADDRESS']))), app)
utils.limiter.init_app(app) utils.limiter.init_app(app)
utils.babel.init_app(app) utils.babel.init_app(app)
utils.login.init_app(app) utils.login.init_app(app)

@ -13,6 +13,7 @@ Flask==1.0.2
Flask-Babel==0.12.2 Flask-Babel==0.12.2
Flask-Bootstrap==3.3.7.1 Flask-Bootstrap==3.3.7.1
Flask-DebugToolbar==0.10.1 Flask-DebugToolbar==0.10.1
Flask-KVSession==0.6.2
Flask-Limiter==1.0.1 Flask-Limiter==1.0.1
Flask-Login==0.4.1 Flask-Login==0.4.1
Flask-Migrate==2.4.0 Flask-Migrate==2.4.0

@ -3,6 +3,7 @@ Flask-Login
Flask-SQLAlchemy Flask-SQLAlchemy
Flask-bootstrap Flask-bootstrap
Flask-Babel Flask-Babel
Flask-KVSession
Flask-migrate Flask-migrate
Flask-script Flask-script
Flask-wtf Flask-wtf

Loading…
Cancel
Save