我尝试使用他们的试用版在 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 许可协议
一些更改,我能够在 docker 中运行您的应用程序。
Twilio_Routing.py
, changehost
to listen on0.0.0.0
instead of127.0.0.1
.This is needed to to have the server available externally as well.app.yaml
已经配置,您不需要自定义Dockerfile
作为Google App Engine
需要。保留它作为您自己的自定义。这是我使用的: