gpt4 book ai didi

python - Google App Engine 部署问题 - 未找到主应用

转载 作者:行者123 更新时间:2023-11-28 18:08:42 24 4
gpt4 key购买 nike

我正在尝试使用 Google App Engine 部署我的应用程序。我编辑了 app.yaml 以反射(reflect)灵活的环境,并提供了所有应用程序信息。下面是 app.yaml 文件。

runtime: python
env: flex
entrypoint: gunicorn -b :$PORT main:app
runtime_config:
python_version: 3

在部署过程中,出现以下错误

[2018-08-24 06:57:14 +0000] [1] [INFO] Starting gunicorn 19.7.1
[2018-08-24 06:57:14 +0000] [1] [INFO] Listening at: http://0.0.0.0:8080 (1)
[2018-08-24 06:57:14 +0000] [1] [INFO] Using worker: sync
[2018-08-24 06:57:14 +0000] [7] [INFO] Booting worker with pid: 7
App Deployed
Failed to find application: 'main'
[2018-08-24 06:57:14 +0000] [7] [INFO] Worker exiting (pid: 7)
[2018-08-24 06:57:14 +0000] [1] [INFO] Shutting down: Master
[2018-08-24 06:57:14 +0000] [1] [INFO] Reason: App failed to load.

请注意,App Deployed 是我的打印语句中的一行。它正在被执行。但是部署失败了

提前致谢

最佳答案

在您的 app.yaml 中,您将使用 gunicorn -b :$PORT main:app 启动 gunicorn。这告诉它在文件 main.py

中查找对象 app

The error you're getting comes from gunicorn当你有一个 main.py 文件,但它没有 app 对象时发生。

您可能想按如下方式设置 Flask 应用程序:

from flask import Flask

app = Flask(__name__)

在此处查看完整的示例应用程序:https://cloud.google.com/appengine/docs/flexible/python/quickstart#hello_world_code_review

关于python - Google App Engine 部署问题 - 未找到主应用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51999065/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com