以 Flask 為例, 在 Linux 下的 command:
$ FLASK_ENV=development FLASK_APP=app.py flask run
在 Windows 下相對應的 command:
(base) PS C:\data\Develop\pytorch\flask_rest_api> $env:FLASK_ENV = 'development'
(base) PS C:\data\Develop\pytorch\flask_rest_api> $env:FLASK_APP = 'app.py'
(base) PS C:\data\Develop\pytorch\flask_rest_api> flask run
* Serving Flask app "app.py" (lazy loading)
* Environment: development
* Debug mode: on
* Restarting with stat
* Debugger is active!
* Debugger PIN: 121-314-480
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
檢查環境變數的內容:
(base) PS C:\data\Develop\pytorch\flask_rest_api> Get-ChildItem env:FLASK_ENV
Name Value
---- -----
FLASK_ENV development