简体   繁体   English

由于 gunicorn AppImportError,应用程序无法启动

[英]Application won't start due to gunicorn AppImportError

I created a pretty basic application using Python and Dash (datatables, html, etc.).我使用 Python 和 Dash(数据表、html 等)创建了一个非常基本的应用程序。 I'm trying to run the application to deploy using gunicorn and Render, but I keep getting an error when I try to deploy it, below is the error:我正在尝试运行应用程序以使用 gunicorn 和 Render 进行部署,但是当我尝试部署它时不断收到错误消息,以下是错误:

File "/opt/render/project/src/.venv/lib/python3.7/site-packages/gunicorn/util.py", 
line 430, in import_app    raise 
AppImportError("Application object must be callable.")gunicorn.errors.AppImportError: 
Application object must be callable.

Every question or piece of documentation I find indicates that it could be something wrong with the naming of files / objects that I have used.我发现的每个问题或文档都表明我使用的文件/对象的命名可能有问题。 Is it possible that the Dash functionality for creating a Dash table being是否有可能用于创建 Dash 表的 Dash 功能是

app = Dash(__ name__)

is causing issues with gunicorn's call to run an application?导致 gunicorn 调用运行应用程序的问题? (see below) (见下文)

gunicorn Fantasy_Stats_Tracking:app

Any help would be amazing!任何帮助都会很棒! Thanks in advance!提前致谢!

The docs seems to say that you need to call app.server and not just app with Gunicorn in order for it to work.文档似乎说您需要调用app.server而不仅仅是使用 Gunicorn 调用app才能使其正常工作。

gunicorn Fantasy_Stats_Tracking:app.server should do the trick, given that your Python file is named Fantasy_Stats_Tracking.py . gunicorn Fantasy_Stats_Tracking:app.server应该可以解决问题,因为您的 Python 文件名为Fantasy_Stats_Tracking.py ref1 ref2参考 1 参考2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM