mikeizbicki / cmc-csci040

Computing for the Web
37 stars 58 forks source link

Error: No Secret Key Set #218

Closed sophiahuangg closed 2 years ago

sophiahuangg commented 2 years ago

Hi Mike,

I'm getting this error RuntimeError: The session is unavailable because no secret key was set. Set the secret_key on the application to something unique and secret. 127.0.0.1 - - [08/Dec/2021 19:44:10] "POST /create_user HTTP/1.1" 500 - when I run my code.

I did import os and randomly selected a string for my secret key, but I',m not really understanding why we need a secret key. What's the purpose of it and does it matter what it's set as? Also, do you know why this error occurs and why it hasn't occurred sooner?

mikeizbicki commented 2 years ago

Without the full stack trace, I can't say for sure, but this error is usually associated with something called "sessions" in flask, which we haven't talked about and you don't need to use.