python+flask+session写供前端使用的后台接口,实现登录保存session时报错。
RuntimeError: The session is unavailable because no secret key was set. Set the secret_key on the application to something unique and secret.
解决办法是
1 app = Flask(__name__) 2 app.config['SECRET_KEY'] = '123456'
session 必须带有['SECRET_KEY'] ,可以随机写一个,也可以自己使用python自带生成随机数模块,生成一个写上。
Be good all the time