flask.cli.NoAppException:无法在模块中找到应用程序? [英] flask.cli.NoAppException: Failed to find application in module?

查看:73
本文介绍了flask.cli.NoAppException:无法在模块中找到应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在关注 http://flask.pocoo.org/上的教程docs/1.0/tutorial/factory/我才刚刚开始,这似乎很简单,但是当我运行应用程序时,我只是想知道为什么会引发此错误:

flask.cli.NoAppException:无法在模块中找到应用程序烧瓶".您确定它包含Flask应用程序吗?可能是你将其包装在WSGI中间件中,或者您正在使用工厂功能.

我相信我已经完美地遵循了这些步骤,为什么会发生这种情况?

解决方案

尝试返回到 flask-tutorial/目录,然后运行 $ flask run 命令./p>

必须从 flask-tutorial/目录(包含flaskr)导入 flaskr .

I am following the tutorial on http://flask.pocoo.org/docs/1.0/tutorial/factory/ I am just starting and it seemed simple but when I had the app running, I am just wondering why it throws this error:

flask.cli.NoAppException: Failed to find application in module "flaskr". Are you sure it contains a Flask application? Maybe you wrapped it in a WSGI middleware or you are using a factory function.

I believe I have followed the steps perfectly, why does this happen?

解决方案

Try going back to the flask-tutorial/ directory, then run $ flask run command.

Importing flaskr must be done from the flask-tutorial/ directory (which contains flaskr).

这篇关于flask.cli.NoAppException:无法在模块中找到应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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