GAE 错误 :- /bin/sh: 1: exec: gunicorn: 未找到

新手上路,请多包涵

我尝试使用他们的试用版在 GAE 上部署我的应用程序。到目前为止,我已经成功地为 python 3.6 的灵活环境创建了一个自定义设置的 app.yaml。

但是,在部署应用程序时,应用程序构建成功,但是,我不断收到以下错误

更新服务 [默认](这可能需要几分钟)…失败。错误:(gcloud.app.deploy) 错误响应:[9] 应用程序启动错误:/bin/sh: 1: exec: gunicorn: not found

以下是我项目中文件的文件夹层次结构:

在此处输入图像描述

按照 app.yaml 的代码

env: flex
runtime: custom
api_version: 1
entrypoint: gunicorn -b :$PORT main:app
runtime_config:
    python_version: 3.6

#handlers:
#- url: /SmsResponse
#  script: Twilio_Routing.RecivedSms
#
#- url: /CallResponse
#  script: Twilio_Routing.ReceivedCall

我肯定错过了一些东西,我真的很感激这里的一些帮助。 链接到 git 仓库

要求.txt

 Flask==0.10.1
gunicorn==19.3.0
twilio==6.8.4

Docker文件

FROM gcr.io/google-appengine/python
LABEL python_version=python3.6
RUN virtualenv --no-download /env -p python3.6

# Set virtualenv environment variables. This is equivalent to running
# source /env/bin/activate
ENV VIRTUAL_ENV /env
ENV PATH /env/bin:$PATH

# Copy the application's requirements.txt and run pip to install all
# dependencies into the virtualenv.
ADD requirements.txt requirements.txt
RUN pip install -r requirements.txt

ADD . /app/

#CMD gunicorn -b :$PORT main:app
ENTRYPOINT [ "python", "Twilio_Routing.py" ]

PS 在对 requirements.txt 进行更改后,我收到错误 502 Bad Gateway。

显示服务执行成功的日志。

 017-12-25 01:29:03 default[20171224t212610]   * Running on http://127.0.0.1:8080/ (Press CTRL+C to quit)
2017-12-25 01:29:03 default[20171224t212610]   * Restarting with stat
2017-12-25 01:29:03 default[20171224t212610]   * Debugger is active!
2017-12-25 01:29:03 default[20171224t212610]   * Debugger PIN: 134-103-452
2017-12-25 01:29:17 default[20171224t212610]   * Running on http://127.0.0.1:8080/ (Press CTRL+C to quit)
2017-12-25 01:29:17 default[20171224t212610]   * Restarting with stat
2017-12-25 01:29:17 default[20171224t212610]   * Debugger is active!
2017-12-25 01:29:17 default[20171224t212610]   * Debugger PIN: 134-103-452

有人可以在 git 中查看我的代码并告诉我我在这里缺少什么吗?

原文由 Afsan Abdulali Gujarati 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 844
2 个回答

一些更改,我能够在 docker 中运行您的应用程序。

  1. In Twilio_Routing.py , change host to listen on 0.0.0.0 instead of 127.0.0.1 .This is needed to to have the server available externally as well.
  2. 由于您的 app.yaml 已经配置,您不需要自定义 Dockerfile 作为 Google App Engine 需要。保留它作为您自己的自定义。这是我使用的:
    #Python's Alpine Base Image
   FROM python:3.6-alpine3.6

   #Installing all python modules specified
   ADD requirements.txt requirements.txt
   RUN pip install -r requirements.txt

   #Copy App Contents
   ADD . /app
   WORKDIR /app

   #Start Flask Server
   CMD [ "python","Twilio_Routing.py"]
   #Expose server port
   EXPOSE 8080

原文由 shubhamr 发布,翻译遵循 CC BY-SA 3.0 许可协议

对我来说,错误就像确保 gunicorn 在 requirements.txt 中一样简单

Flask==1.0.2
gunicorn==19.9.0

笔记:

我看到 OP 添加了这个标志;这是为了帮助其他可能 exec: gunicorn: not found 的人

原文由 Casey 发布,翻译遵循 CC BY-SA 4.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题