【问题标题】:How to Handle Gunicorn Error on GAE deployment如何处理 GAE 部署中的 Gunicorn 错误
【发布时间】:2020-08-16 13:55:27
【问题描述】:

我正在尝试在 GAE 上部署 python 服务,当我部署它时出现以下错误Error on GAE logs

我没有在我的 requirements.txt 文件中添加 Gunicorn,但是当我在 GAE 上调试我的服务时,我在 Requirement 文件中看到了它。

谁能帮忙找出问题所在。 我的服务中只有一个 main.py,这是我正在使用的 Yaml

service: service
runtime: python37
runtime_config:
  python_version: 3

# [START handlers]
handlers:
- url: /.*
  script: auto

Requirement.txt 文件

Flask==1.0.4
Werkzeug>=0.14
google-cloud-pubsub==0.37.2

main.py

import logging
import os
import time
import sys
import json

# [START imports]
from flask import Flask, render_template, request, jsonify
from google.cloud import pubsub

app = Flask(__name__)
@app.route('/publish', methods=['POST'])
def form():
    data = request.json

    if data:
       return jsonify({"message": "DONE"})
    else:
       return "Hello World"

【问题讨论】:

  • 能否添加整个回溯,而不仅仅是最后一行的片段作为图片,好吗? AppEngine 是标准的还是灵活的?
  • 发布的图片是到达端点后的第一行日志,以及它的 AppEngine 标准
  • 你的main.py看起来怎么样?
  • 在上面的描述中添加了 Main.py @yedpodtrzitko
  • 谢谢。不知道,不完整的回溯让我感到困惑。也许尝试设置日志客户端cloud.google.com/logging/docs/setup/python,如果它会改进它?还有为什么 pubsub 0.37.2,那是好几年了...

标签: python-3.x google-app-engine gunicorn


【解决方案1】:

在 requirements.txt 中添加依赖六解决了我的问题。

 six==1.14.0

【讨论】:

  • 您能否使用解决问题的确切行编辑您的答案?
  • 完成后不要忘记accept your own answer
  • 请更新您的答案以提供问题的完整解决方案,因为它可能对面临相同问题的其他人有所帮助。
猜你喜欢
  • 2020-05-12
  • 2017-11-07
  • 1970-01-01
  • 2021-11-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-06-04
相关资源
最近更新 更多