RuntimeError: The session is unavailable because no secret key was set.

RuntimeError: The session is unavailable because no secret key was set. Set the secret_key on the application to something unique and secret.

在flask中遇到这种错,很容易解决,就是没有设置secret_key,django在配置文件中自动生成secret_key

# 两种方式设置secret_key
# app.secret_key = 'TPmi4aLWRbyVq8zu9v82dWYW1'
app.config["SECRET_KEY"] = 'TPmi4aLWRbyVq8zu9v82dWYW1'

你可能感兴趣的:(遇到bug时,RuntimeError:,The,session,is,unavai)