Your return value must be one of several types: a basestring ( string or unicode ), a tuple (representing the arguments passed to the constructor of the Response object), a Response object itself, or - rejection of them - a function that calls WSGI.
You return the bool . Flask suggests that since it is not a basestring , tuple or Response object, it must be WSGI-invoked. Subsequently, when processing the response, it tries to call () your return value bool , which leads to an exception. The flag captures the received TypeError. When Flask is in debug mode, it passes this back to a simple Werkzeug web server, which will call the built-in debugger. However, when Flask is in production mode, it will simply cause an internal server error - for example, code 500 - without additional information.
So, to fix your problem, make sure you do this:
return str('user' in session)
source share