mirror of
https://github.com/jiojciojsioe3/a3cjroijsiojiorj.git
synced 2024-11-15 15:31:51 +08:00
Merge pull request #209 from N-Field/fix-session-redis
Fix crash when using non-localhost redis
This commit is contained in:
commit
d98b2d9697
7
app.py
7
app.py
@ -17,12 +17,19 @@ from flask_session import Session
|
|||||||
from flask_wtf.csrf import CSRFProtect, generate_csrf, CSRFError
|
from flask_wtf.csrf import CSRFProtect, generate_csrf, CSRFError
|
||||||
from ffmpy import FFmpeg
|
from ffmpy import FFmpeg
|
||||||
from pymongo import MongoClient
|
from pymongo import MongoClient
|
||||||
|
from redis import Redis
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
client = MongoClient(host=config.MONGO['host'])
|
client = MongoClient(host=config.MONGO['host'])
|
||||||
|
|
||||||
app.secret_key = config.SECRET_KEY
|
app.secret_key = config.SECRET_KEY
|
||||||
app.config['SESSION_TYPE'] = 'redis'
|
app.config['SESSION_TYPE'] = 'redis'
|
||||||
|
app.config['SESSION_REDIS'] = Redis(
|
||||||
|
host=config.REDIS['CACHE_REDIS_HOST'],
|
||||||
|
port=config.REDIS['CACHE_REDIS_PORT'],
|
||||||
|
password=config.REDIS['CACHE_REDIS_PASSWORD'],
|
||||||
|
db=config.REDIS['CACHE_REDIS_DB']
|
||||||
|
)
|
||||||
app.cache = Cache(app, config=config.REDIS)
|
app.cache = Cache(app, config=config.REDIS)
|
||||||
sess = Session()
|
sess = Session()
|
||||||
sess.init_app(app)
|
sess.init_app(app)
|
||||||
|
Loading…
Reference in New Issue
Block a user