我正在尝试使用谷歌应用程序引擎部署我的应用程序。我已经编辑了App.YAML,以反映灵活的环境,并给出了所有的应用程序信息。下面是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.yaml中,您将使用gunicorn -b :$PORT main:app启动gunicorn。这告诉它在文件中查找对象app
The error you're getting comes from gunicorn并在您有一个main.py文件但其中没有main.py对象时发生。
您可能需要按如下方式设置烧瓶应用程序:

from flask import Flask

app = Flask(__name__)

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

10-06 05:25
查看更多