Quick notes on UWSGI debugging, because I keep forgetting.
FLASK_DEBUG
does not work for UWSGI apps. You’ll need the following code in your Flask app, courtesy StackOverflow:
from werkzeug.debug import DebuggedApplication
app.wsgi_app = DebuggedApplication(app.wsgi_app, True)
To activate it, it’s probably easiest to pass an environment variable. For example, in your UWSGI configuration:
env=APP_DEBUG=1
and then in the app:
if 'APP_DEBUG' in os.environ:
app.debug = True
from werkzeug.debug import DebuggedApplication
app.wsgi_app = DebuggedApplication(app.wsgi_app, True)
To enable hot-reloading of modified files, just set:
py-autoreload=5
to check for modified files every 5 seconds and reload them as necessary.
Comments are moderated whenever I remember that I have a blog.
There are no comments on this article.