Flask 找不到应用程序文件 [英] Flask can't find app file
本文介绍了Flask 找不到应用程序文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 Flask 官方教程的第 2 步中,Flask 找不到我的应用程序文件,因为它在 ../venv/Scripts/
而不是我运行命令的位置.我怎样才能告诉 Flask 在正确的地方寻找?
In Step 2 of the official Flask tutorial, Flask cannot find my app file because it's looking in ../venv/Scripts/
instead of where I run the command. How can I tell Flask to look in the right place?
(venv) C:UsersTomVCodesflaskr_tutorial>flask run
* Serving Flask app "flaskr"
* Forcing debug mode on
* Restarting with stat
c:users omvcodesflaskr_tutorialvenvscriptspython.exe: can't open file 'C:UsersTomVCodesflaskr_tutorialvenvScriptsflask': [Errno 2] No such file or directory
推荐答案
根据这个 github issue 似乎有一个错误:
There seems to a bug according to this github issue:
https://github.com/pallets/flask/issues/1829
作为一种解决方法,您可以这样做
As a workaround you can do
>python -m flask run
您还可以在本教程后面的初始化数据库(第 4 步)时使用 >python -m flask initdb
.
You can also use >python -m flask initdb
later in the tutorial, when initializing the database (step 4).
这篇关于Flask 找不到应用程序文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文