In my flask web application I use beaker library for session handling. In the following code, for some unknown reason, production server raises exception, but my local pc does just fine.
import sys
...
try:
beaker_session = request.environ['beaker.session']
beaker_session['user_id'] = user.id
beaker_session.save()
except:
flash(sys.exc_info()[0])
return render_template('main/login.html')
Local computer saves the session just as expected, without any exception. Production server (RedHat OpenShift) raises an error exactly on "beaker_session.save()" line. But, instead of showing my login page with flash message, Internal Server Error 500 is thrown. I checked beaker backend url (mysql db) and there's no problem, because it works in other parts of code, where I persist newly registered users. So, my question is 1) why except part doesn't work? 2) why beaker cannot save the session. Thank you.