Env. Variables not set while running Minimal Flask application

前端 未结 19 2003

I am trying to follow the flask documentation on my windows machine given at the following link: http://flask.pocoo.org/docs/0.11/quickstart/#debug-mode

Firstly I wrote

19条回答
  •  闹比i
    闹比i (楼主)
    2021-01-30 03:51

    Here is what worked for me:

    • Step 1: Open your CMD Command prompt
    • Step 2: Go on the same directory in which my python file was on.
    • Step 3: in the CMD command prompt run the command setx FLASK_APP sqlAlchemy.py
    • Step 4: close terminal
    • Step 5: In the CMD command prompt run the command python - m flask run

    I have an Alienware laptop and am using Windows 10.

    Not sure it worked but it was a combination of trial and ever. Depending on the OS you have the solution will vary it seems. IT could be an environmental variable issue but again not sure.

    - Here are other possible solutions that didn't work for me but I gathered them up as possibilities.

    • OPTION 2
    • set FLASK_APP=sqlalchemy.py
      • flask run
    • OPTION 3
    • set FLASK_APP=app
    • set FLASK_ENV=development
      • flask run Hope this helps.

提交回复
热议问题