标签:red imp turn dex date items == update pre
安装
pip install flask_session
使用
from flask import Flask
from flask import session
from flask_session import Session
from redis import Redis
app = Flask(__name__)
app.config[‘SESSION_TYPE‘] = ‘redis‘
app.config[‘SESSION_REDIS‘] = Redis(host=‘192.168.100.10‘, password=‘000000‘)
Session(app)
@app.route(‘/index1‘)
def index():
ret = session.items()
print(ret)
return ‘index1‘
@app.route(‘/index2‘)
def index2():
session.update({‘a‘:123})
return ‘index2‘
if __name__ == ‘__main__‘:
app.run()
标签:red imp turn dex date items == update pre
原文地址:https://www.cnblogs.com/xiasir/p/13024622.html