首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >gunicorn未能在“app”中找到属性“app”

gunicorn未能在“app”中找到属性“app”
EN

Stack Overflow用户
提问于 2022-07-24 22:19:38
回答 1查看 255关注 0票数 0

我希望有人能帮忙。我一直试图在ubuntu上启动我的烧瓶应用程序。这个应用程序在dev模式下运行,但是当我尝试使用gunicorn运行它时,我会得到以下错误:

代码语言:javascript
运行
复制
[2022-07-24 21:55:44 +0000] [3710] [INFO] Starting gunicorn 20.1.0
[2022-07-24 21:55:44 +0000] [3710] [INFO] Listening at: http://127.0.0.1:8000 (3710)
[2022-07-24 21:55:44 +0000] [3710] [INFO] Using worker: sync
[2022-07-24 21:55:44 +0000] [3711] [INFO] Booting worker with pid: 3711
Failed to find attribute 'app' in 'app'.
[2022-07-24 21:55:44 +0000] [3711] [INFO] Worker exiting (pid: 3711)
[2022-07-24 21:55:44 +0000] [3710] [INFO] Shutting down: Master
[2022-07-24 21:55:44 +0000] [3710] [INFO] Reason: App failed to load.


Here is my app.py file
from website import create_app

if __name__ == "__main__":
    app = create_app()
    app.run(debug=True)

这里是场地结构。

网站

  • script
  • static -templates -apy.py -auth.py -db -models -views -innit.py app.py

有人能帮忙吗?

谢谢

S

EN

回答 1

Stack Overflow用户

发布于 2022-07-25 12:16:06

我发现了问题。必须将app=create_app移至“if”语句的上方。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73102470

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档