Dubugging Flask applications under uWSGI
Flask comes with a fantastic debug mode available with the built-in server, but is advertised as unusable under uWSGI, due to some forking limitations, which I couldn’t understand. There is a way that allows you to spawn the development debug mode in Flask (and Werkzeug) regardless of what everyone around seems to say.
if __name__ == '__main__': part of your application, i.e. at the very end, you have to wrap a
werkzeug.debug.DebuggedApplication middleware around your
if ( app.debug ): from werkzeug.debug import DebuggedApplication app.wsgi_app = DebuggedApplication( app.wsgi_app, True )
That’s it. Simple as that! Debug your Flask application from the browser, without using the built-in development server. Don’t forget to switch off debugging in production, as the console offers arbitrary code execution.
For everything else there’s Winpdb.