Reputation: 5968
I am following the tutorial on http://flask.pocoo.org/docs/1.0/tutorial/factory/ I am just starting and it seemed simple but when I had the app running, I am just wondering why it throws this error:
flask.cli.NoAppException: Failed to find application in module "flaskr". Are you sure it contains a Flask application? Maybe you wrapped it in a WSGI middleware or you are using a factory function.
I believe I have followed the steps perfectly, why does this happen?
Upvotes: 1
Views: 3956
Reputation: 3693
This is an issue with python not able to find the app in the path.
Add this code and test:
import sys
print(sys.path)
Check if the printed path array has containing folder's path. If not, for a quick fix use
sys.path.append('./')
Otherwise you will have to investigate where you are messing with the python path.
Upvotes: 0
Reputation: 11
Try going back to the flask-tutorial/
directory, then run $ flask run
command.
Importing flaskr
must be done from the flask-tutorial/
directory (which contains flaskr).
Upvotes: 1