Env. Variables not set while running Minimal Flask application

前端 未结 19 2051

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
    2021-01-30 03:50

    You have to set the FLASK_APP variable outside of the virtual environment. I'm assuming the reason that it worked after @Fang restarted the command window is because that action automatically exited the virtual environment.

    So, if you're in the virtual environment (indicated by a (venv) at the start of line on command window), then type the following commands:

    deactivate
    
    set FLASK_APP=run.py
    
    venv\scripts\activate
    
    flask run
    

提交回复
热议问题