Is it possible to keep reloading with flask even though I have syntax errors Is it possible to keep reloading with flask even though I have syntax errors flask flask

Is it possible to keep reloading with flask even though I have syntax errors


The 2021 answer to this question is to run your app with flask run. You probably want to set FLASK_ENV=development in the environment too. The Flask runner will wrap your code in a safe loader that handles syntax errors when loading your Python code.

Note that in Flask 2.0.1 (the latest release at the moment) there's a bug where syntax errors in your code will be replaced by a strange TypeError. That bug was fixed at the end of June 2021 but that version has not yet shipped. The error report is not great but Flask will reload once you fix your syntax error.