How to setup environment variables for `flask run` on Windows?

前端 未结 14 1887
囚心锁ツ
囚心锁ツ 2021-02-04 10:19

I just started learning flask and I am stuck at setting up the Flask environment variables. I don\'t know how to setup the environment variables. Whenever I use the flask

14条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-04 11:04

    You need to specify the environment of the application. Like this

    export FLASK_APP = application.py

    after performing this operation

    flask run

    But my suggestion is that it will be easier for you to perform these operations there while creating your application, rather than constantly stating this in the terminal. After reviewing the documentation, if you do what I said, it will be enough to come to the terminal and run python app.py runserver in terminal.

    You can check flask's documentation for that. https://flask.palletsprojects.com/en/1.1.x/patterns/appfactories/

提交回复
热议问题