Menu Close

How to debug a Python Flask app running in Gunicorn?

How to debug a Python Flask app running in Gunicorn

Sometimes, we want to debug a Python Flask app running in Gunicorn.

In this article, we’ll look at how to debug a Python Flask app running in Gunicorn.

How to debug a Python Flask app running in Gunicorn?

To debug a Python Flask app running in Gunicorn, we can set the DEBUG setting to True.

For instance, we write

app = Flask(__name__)
app.config.from_pyfile('config.py') 

to read the config from config.py with from_pyfile.

Then we write

DEBUG = True 

to set the DEBUG setting to True to enable debugging in our Flask app.

Conclusion

To debug a Python Flask app running in Gunicorn, we can set the DEBUG setting to True.

Posted in Python

You can also read...