Flask 报错 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.

When we run the Flask project on the liunx system, we encounter this error:
insert image description here

Solution:

It is basically said on the Internet, set SECRET_KEY under the Flask object app:
add it to the startup file of my project, I can successfully run the project under window10, but it cannot succeed on the liunx system or an error is
insert image description here
added here under the startup file of my project Can run successfully in linux
insert image description here

Guess you like

Origin blog.csdn.net/weixin_45688123/article/details/121250330