Flask找不到应用程序文件 [英] Flask can't find app file

查看:675
本文介绍了Flask找不到应用程序文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在官方Flask教程的第2步中, Flask找不到我的应用程序文件,因为它在 ../ venv / Scripts / 中查找,而不是在我运行命令的位置。我怎么能告诉Flask看在正确的地方?

 (venv)C:\ Users \TomV\Codes\flaskr_tutorial>烧瓶运行
*服务Flask应用程序flaskr
*在
上强制调试模式*使用stat
c:\users\tomv\codes\flaskr_tutorial\venv\scripts\python.exe重新启动:无法打开文件'C:\ Users \TomV\Codes\flaskr_tutorial\venv\Scripts\flask':[Errno 2]没有这样的文件或目录

解决方案

解决方案

b $ b

https://github.com/pallets/flask/issues/1829



作为一个解决方法,您可以执行

 > python -m flask run 

您也可以使用> python -m flask initdb 稍后在教程中,初始化数据库(第4步)。


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:\Users\TomV\Codes\flaskr_tutorial>flask run
 * Serving Flask app "flaskr"
 * Forcing debug mode on
 * Restarting with stat
c:\users\tomv\codes\flaskr_tutorial\venv\scripts\python.exe: can't open file 'C:\Users\TomV\Codes\flaskr_tutorial\venv\Scripts\flask': [Errno 2] No such file or directory

解决方案

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

You can also use >python -m flask initdb later in the tutorial, when initializing the database (step 4).

这篇关于Flask找不到应用程序文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆