Auto reloading python Flask app upon code changes

Run the flask run CLI command with debug mode enabled, which will automatically enable the reloader. As of Flask 2.2, you can pass --app and --debug options on the command line.

$ flask --app main.py --debug run

--app can also be set to module:app or module:create_app instead of module.py. See the docs for a full explanation.

More options are available with:

$ flask run --help

Prior to Flask 2.2, you needed to set the FLASK_APP and FLASK_ENV=development environment variables.

$ export FLASK_APP=main.py
$ export FLASK_ENV=development
$ flask run

It is still possible to set FLASK_APP and FLASK_DEBUG=1 in Flask 2.2.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)