Flask Session报错的解决方法:RuntimeError: The session is unavailable because no secret key was set.
2016-11-23 16:47
1451 查看
flask session在初始化时报错:RuntimeError: The session is unavailable because no secret key was set. Set the secret_key on the application to something unique and secret.
解决方法:增加app.config['SESSION_TYPE'] = 'filesystem'语句
from flask import Flask, session from flask_session import Session import os app = Flask(__name__) app.config['SECRET_KEY'] = os.urandom(24) Session(app)
解决方法:增加app.config['SESSION_TYPE'] = 'filesystem'语句
from flask import Flask, session from flask_session import Session import os app = Flask(__name__) app.config['SESSION_TYPE'] = 'filesystem' app.config['SECRET_KEY'] = os.urandom(24) Session(app)
相关文章推荐
- Flask 使用消息闪烁(flash)报错:The session is unavailable because no secret key was set。。。
- vs2005下出现“Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive”的解决方法
- Oracle OEM 配置报错: No value was set for the parameter DBCONTROL_HTTP_PORT 解决方法
- Oracle OEM 配置报错: No value was set for the parameter DBCONTROL_HTTP_PORT 解决方法
- Oracle OEM 配置报错: No value was set for the parameter DBCONTROL_HTTP_PORT 解决方法
- Oracle OEM 配置报错: No value was set for the parameter DBCONTROL_HTTP_PORT 解决方法
- Oracle OEM 配置报错: No value was set for the parameter DBCONTROL_HTTP_PORT 解决方法
- Oracle OEM 配置报错: No value was set for the parameter DBCONTROL_HTTP_PORT 解决方法
- Oracle OEM 配置报错: No value was set for the parameter DBCONTROL_HTTP_PORT 解决方法
- Oracle OEM 配置报错: No value was set for the parameter DBCONTROL_HTTP_PORT 解决方法
- RuntimeError: Unable to create a new session key. It is likely that the cache is unavailable.
- Project has no default.properties file! Edit the project properties to set one.错误解决方法
- Android中导入工程出现Project has no default.properties file! Edit the project properties to set one.的解决方法
- There is no Citrix MetaFrame server configured on the specified address错误的解决方法
- could not initialize proxy - the owning Session was closed解决方法!
- Project has no default.properties file! Edit the project properties to set one.错误解决方法
- there is no source code available for the current location的解决方法
- The RPC server is unavailable的解决方法
- MPI编译C++程序出现#error "SEEK_SET is #defined but must not be for the C++ binding of MPI" 的解决方法
- Project has no default.properties file! Edit the project properties to set one.错误解决方法