Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flask Session will not Persist

I have recently deployed my first Flask application (first web application ever actually), one problem I am running into and haven't had luck tracking down is related to sessions.

What I am doing is when the user logs in I set session['user'] = user_id and what is happening is I occasionally get a key error when making a request involving that session key. If I try to make the request again the session key is there and the request works fine. I have done research and set the app.config['SERVER_NAME'] to my domain and made sure the secret_key was static, it was dynamic before.

This does not happen when on my local development server so I am a bit stumped at this point.

like image 624
jsm1th Avatar asked Mar 26 '14 23:03

jsm1th


1 Answers

Problem was that I had the key static in my init which caused it to work in dev but in production in the .wsgi it was still dynmaic, I have changed this and all seems to be working now.

like image 62
jsm1th Avatar answered Sep 18 '22 07:09

jsm1th