1 min read
Error in Detail
Usage: flask run [OPTIONS]
Error: Could not locate Flask application. You did not provide the FLASK_APP environment variable.
Tried many ways but far nothing has worked and the error message is the same in each case. How can I fix this error?
Vishal Sharma Answered question February 27, 2020
1 min read
This is how I solve my error
Assuming you had 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.
Vishal Sharma Answered question February 27, 2020