I am trying to activate debug mode in Flask.
What I have tried so far:
- set FLASK_ENV=development directly in Windows cmd
- pip installed python-dotenv successfully and set FLASKENV=development in .env file
- ensured that there is no dotenv package globally and within virtual env
- pip force uninstall/reinstall python-dotenv a few times
- with python-dotenv, tried
load_dotenv()
andos.getenv('FLASK_ENV')
and it shows that the value of FLASK_ENV isdevelopment
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?