-
运行环境Windows系统, 命令行工具powershell
-
执行如下命令报错:
- 设置
set FLASK_APP = run.py
- 运行
flask run
- 设置
-
报错如下: Flask找不到上面设置的应用,或者说找不到运行脚本
run.py
而报出:Error: Could not locate flask application. You did not provide the FLASK_APP environment variable
-
具体原因不清楚,不过找到了解决方案,将下面命令替换
set FLASK_APP = run.py
成$env:FLASK_APP = "run.py"
参考自Stack Overflow: https://stackoverflow.com/questions/37826016/env-variables-not-set-while-running-minimal-flask-application
问题:
解决方案: