本文介绍了GAE错误:-/bin/sh:1:exec:gunicorn:找不到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用他们的试用版在GAE上部署我的应用程序.到目前为止,我在使用python 3.6创建具有自定义设置的灵活环境的app.yaml方面取得了成功.

I trying to deploy my app on GAE using their trial version. I was so far successful in creating an app.yaml with a custom settings for flexible environment with python 3.6.

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

However, while deploying the app, the app builds successfully, however, I keep getting the following error

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

Following is the folder hierarchy of files in my project:

按照app.yaml的代码

Following the code for 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 repo

I am surely missing out on something and I would really appreciate some help here.Link to git repo

requirements.txt

requirements.txt

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

DockerFile

DockerFile

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" ]

P.S.更改了requirements.txt之后,我收到错误502错误的网关.

P.S. After the changes for the requirements.txt, I am getting error 502 Bad Gateway.

显示该服务已成功执行的日志.

Logs showing that the service was executed successfully.

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中查看我的代码并告诉我我在这里缺少什么吗?

Can someone look at my code in git and tell me what is it that I am missing here?

推荐答案

进行了一些更改,我得以在docker中运行您的应用.

A few changes and I was able to run your app in docker.

  1. Twilio_Routing.py 中,更改 host 以监听 0.0.0.0 而不是 127.0.0.1 .为了使服务器也可以在外部使用,需要这样做.
  2. 由于已经配置了 app.yaml ,因此您无需根据 Google App Engine 的要求自定义 Dockerfile .将其保留为您自己的自定义名称.这是我使用的内容:

  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. Since your app.yaml is already configured, you don't need to customize your Dockerfile as Google App Engine requires. Keep it as your own custom one.Here's what I used:

#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

这篇关于GAE错误:-/bin/sh:1:exec:gunicorn:找不到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 04:34