FLASK_应用程序变量即使在.env中也不起作用

2024-06-10 06:11:07 发布

您现在位置:Python中文网/ 问答频道 /正文

我已经安装了python-dotenv==0.6.5

我把FLASK_APP放在.env文件中

DEBUG=True
FLASK_ENV=development
FLASK_APP=flasky.py

但是当我运行flask run时,它显示了这个错误

Usage: flask run [OPTIONS]

Error: Could not locate Flask application. You did not provide the FLASK_APP environment variable.

For more information see http://flask.pocoo.org/docs/latest/quickstart/

但是如果我{},它工作得很好

我还试图将FLASK_APP=flasky.py放入.flaskenv文件中,但没有成功:(

所有其他环境变量都加载良好。谢谢


Tags: 文件runpydebugenvtrueappflask