pythonflaskpython-dotenv

Flask is not reacting to the FLASK_ENV variable setting


I am trying to activate debug mode in Flask.

What I have tried so far:

None of the above enabled the debug mode of Flask. FLASK_APP variable is correctly set and read though. Only by running Flask --debug run activates the debug mode.

Why is the FLASK_ENV variable not recognized by Flask?


Solution

  • As pointed out by ivvija: In Flask version 2.3.0, the FLASK_ENV environment variable (including the ENV config key and app.env property) has been removed.

    You should instead set FLASK_DEBUG=1, or set debug=True in your app.run() method or use the --debug option when running the flask run command to enable debug mode - any of these will work.