首页 > 解决方案 > Gunicorn 迷恋 GC AppEngine

问题描述

今天我尝试在 Google Cloud AppEngine 上部署 Python 应用程序。这个版本之前部署成功,现在却因为奇怪的原因崩溃了。
/_ah/start 上的请求返回 502 错误消息:

This request caused a new process to be started for your application, and thus caused your application code to be loaded for the first time. This request may thus take longer and use more CPU than a typical request for your application.


然后几秒钟后
500 状态代码和下一条消息:

The request failed because the instance could not start successfully

错误报告显示此应用的一个异常:

File "/env/lib/python3.7/site-packages/gunicorn/arbiter.py", line 245, 
in handle_chld
at sleep (/env/lib/python3.7/site-packages/gunicorn/arbiter.py:360)
at run (/env/lib/python3.7/site-packages/gunicorn/arbiter.py:210)

以下消息也出现在日志中:

Application object must be callable.

所以,我不明白什么是错误的,因为这个版本之前部署得很好。

应用程序.yaml:

runtime: python37
service: service_name
instance_class: B2

entrypoint: gunicorn -b :$PORT main:app.server

manual_scaling:
  instances: 1

标签: pythongoogle-app-enginegoogle-cloud-platformgunicorn

解决方案


推荐阅读