Reputation: 101
I am trying to learn flask and for the same created a small program. When I try to run it I am getting the below error. flask run
Error-
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: off
Usage: flask run [OPTIONS]
Error: Could not locate a Flask application. You did not provide the "FLASK_APP" environment variable, and a "wsgi.py" or "app.py" module was not found in the current directory.
if I try to change the file name to app.py
it runs smooth but when the file name is flaskblog.py
it isn't working.
I tried setting up the environment variables as suggested in the blog-> How to set environment variables in PyCharm? but nothing worked.
Screenshots attached. content of environment variable file
Upvotes: 2
Views: 9272
Reputation: 21
Open Settings -> Tools -> Terminal and there set up the environment variable FLASK_APP=app.py. Next, perform restart of PyCharm.
Upvotes: 2
Reputation: 101
I was able to resolve this by setting up the environment variable on the terminal itself.
set FLASK_APP=flaskblog.py
and then it ran like smoothly.
Upvotes: 1