Flask: Unable to execute Flask.

Created on 18 Oct 2017  路  3Comments  路  Source: pallets/flask

i installed flask and flask-ask . and then i wrote flask run command but error occured
it says : Could not locate Flask application. You did not provide the FLASK_APP environment variable.
i'm stuck here.
plz help me.

Most helpful comment

Can you provide your code for more information
When you use flask run, don't forget export your app: $ export FLASK_APP=yourapp.py
You suggested: Could not locate Flask application => make sure you are in the folder contain your flask app
Another way of run a flask app, add the code below

if __name__ == '__main__':
    app.run(debug=True)

use: 'python yourapp.py' to run

All 3 comments

Can you provide your code for more information
When you use flask run, don't forget export your app: $ export FLASK_APP=yourapp.py
You suggested: Could not locate Flask application => make sure you are in the folder contain your flask app
Another way of run a flask app, add the code below

if __name__ == '__main__':
    app.run(debug=True)

use: 'python yourapp.py' to run

I had the same problem. It is embarrassing that it did not work when I show off flask to a beginner. I tried latter solution to save the show.

This has been updated in master. Please use Stack Overflow for questions about your own code. This tracker is for issues with Flask itself. Be sure to include a minimal, complete, and verifiable example.

Was this page helpful?
0 / 5 - 0 ratings