Flask says "did not provide the FLASK_APP environment variable"

If you are on Windows, make sure there is no space around the equal :

set FLASK_APP=app.py

instead of

set FLASK_APP = app.py

That's what happened to me. I got the " You did not provide the FLASK_APP environment variable" error because of the spaces.


Assuming you call app=App(__name__) in your init file. Try this, even though technically it should work with run.py as-well.

export FLASK_APP=app/__init__.py; flask run

Also try doing an echo $FLASK_APP later to see if the value actually gets stored in the environment variable which flask directly accesses and not only the bash profile.