6

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.

juanreyesv
  • 853
  • 9
  • 22
jsm1th
  • 469
  • 2
  • 4
  • 16
  • How is your application deployed? – Joe Doherty Mar 27 '14 at 10:10
  • @JoeDoherty I used the following digitalocean tutorial, this was my first deployment. [Digitalocean Flask Depoyment Tutorial](https://www.digitalocean.com/community/articles/how-to-deploy-a-flask-application-on-an-ubuntu-vps) – jsm1th Mar 27 '14 at 12:12

1 Answers1

6

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.

jsm1th
  • 469
  • 2
  • 4
  • 16