7

I use windows and I'm trying to run flask through Git Bash and ConEmu. I entered the following commands:

set FLASK_APP=application.py
set FLASK_DEBUG=1
set DATABASE_URL=postgres://someurl
flask run

and this was the result:

* Environment: production
WARNING: Do not use the development server in a production environment.
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.

Do I need to write the commands directly into the bash file?

EDIT: I tried setting the variables in bash_profile, but that did not change the results I got. (I did remember to restart my terminal.)

davidism
  • 121,510
  • 29
  • 395
  • 339
Mulan
  • 81
  • 1
  • 1
  • 7

1 Answers1

7

You can set it locally for the command:

FLASK_APP=application.py FLASK_DEBUG=1 DATABASE_URL=postgres://someurl flask run

Or you can set it permanently for the session:

export FLASK_APP=application.py
export FLASK_DEBUG=1 
export DATABASE_URL=postgres://someurl 
flask run

The point is: there is no set var=value in git bash as you would use in a CMD. set, in bash, has another meaning.

Change the value of a shell option and set the positional parameters

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250