Afs*_*ati 5 python git api google-app-engine flask
我尝试使用他们的试用版在GAE上部署我的应用程序。到目前为止,我在使用python 3.6创建具有自定义设置的灵活环境的app.yaml方面非常成功。
但是,在部署应用程序时,该应用程序成功构建,但是,我不断遇到以下错误
更新服务[默认](这可能需要几分钟)...失败。错误:(gcloud.app.deploy)错误响应:[9]应用程序启动错误:/ bin / sh:1:exec:gunicorn:未找到
以下是我项目中文件的文件夹层次结构:
遵循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
Run Code Online (Sandbox Code Playgroud)
我肯定会错过一些东西,在这里我会非常感谢。 链接到git repo
requirements.txt
Flask==0.10.1
gunicorn==19.3.0
twilio==6.8.4
Run Code Online (Sandbox Code Playgroud)
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" ]
Run Code Online (Sandbox Code Playgroud)
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
Run Code Online (Sandbox Code Playgroud)
有人可以在git中查看我的代码并告诉我我在这里缺少什么吗?
经过一些更改,我能够在 docker 中运行您的应用程序。
Twilio_Routing.py,更改host为监听0.0.0.0而不是127.0.0.1。这也是使服务器在外部可用所必需的。由于您的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
Run Code Online (Sandbox Code Playgroud)对我来说,错误很简单,只要确保已放入金枪鱼即可 requirements.txt
Flask==1.0.2
gunicorn==19.9.0
Run Code Online (Sandbox Code Playgroud)
注意:
我看到OP添加了此标志;这是为了帮助可能遇到的其他人exec: gunicorn: not found
| 归档时间: |
|
| 查看次数: |
6502 次 |
| 最近记录: |