首先,我想宣告我已經搜索了一個解決方案,但對我沒有任何幫助......
我正在嘗試在 App 引擎上部署燒瓶服務器,但我總是收到 404 錯誤/readiness_check failReason:"null"
這是我的 app.yaml(是的,我確實增加了app_start_timeout_sec
)
# yaml config for custom environment that uses docker
runtime: custom
env: flex
service: test-appengine
# change readiness check ;
# rediness failure leads to 502 Error
readiness_check:
path: "/readiness_check"
check_interval_sec: 5
timeout_sec: 4
failure_threshold: 2
success_threshold: 2
app_start_timeout_sec: 1800
這是我的Dockerfile
:
# Use the official Python image.
# https://hub.docker.com/_/python
FROM python:3.8-buster
# Install Python dependencies.
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
# Copy local code to the container image.
ENV APP_HOME /app
WORKDIR $APP_HOME
COPY . .
# expose port 8080 for app engine
EXPOSE 8080
# Run the web service on container startup. Here we use the gunicorn
# webserver, with one worker process and 8 threads.
# For environments with multiple CPU cores, increase the number of workers
# to be equal to the cores available.
# CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 main:app
CMD ["gunicorn", "main:app", "-b", ":8080", "--timeout", "300"]
main.py
最后,為了論證, my包含一個非常基本的路線:
from flask import Flask
app = Flask(__name__)
@app.route("/")
def return_hello():
return "Hello!"
你能告訴我我做錯了什么嗎?幾天來一直在與這個問題作斗爭......謝謝!
uj5u.com熱心網友回復:
我相信你仍然需要為你定義處理程式readiness_check
(你得到 404,這意味著找不到路由)。
有關示例,請參閱本文
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/507747.html
標籤:Google Cloud Collective Python 码头工人 烧瓶 谷歌应用引擎 谷歌云平台