Flask run not working when running it on powershell

Question:

Error: Could not locate a Flask application. Use the ‘flask –app’ option, ‘FLASK_APP’ environment variable, or a ‘wsgi.py’ or ‘app.py’ file in the current directory.

I am trying to run flask as I am just starting to learn about back end but I cant seem to solve this problem. Please help

Asked By: slade walters

||

Answers:

First check you working directory, you should be in the same directory that your flask app is, you can use cd c:/path/to/app to change directory or hold shift and right click in that directory and choose open powershell here.

Also it is better to rename your app to app.py, flask will run it by default, otherwise you should set FLASK_APP variable with $env:FLASK_APP = "app_name.py"

Answered By: BSimjoo
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.