Python Can';t访问健康检查
我目前正在使用Django开发一个web应用程序。我使用了这个app.yaml,它在google app engine上成功部署。但是,我无法访问/_hc,因为Django检查url是否在url模式中,它只是用“未找到页面”进行响应。我该如何解决这个问题Python Can';t访问健康检查,python,python-3.x,django,google-app-engine,Python,Python 3.x,Django,Google App Engine,我目前正在使用Django开发一个web应用程序。我使用了这个app.yaml,它在google app engine上成功部署。但是,我无法访问/_hc,因为Django检查url是否在url模式中,它只是用“未找到页面”进行响应。我该如何解决这个问题 runtime: python37 entrypoint: bash -c 'gunicorn -b :$PORT projectservice.wsgi' liveness_check: path: "/_hc"
runtime: python37
entrypoint: bash -c 'gunicorn -b :$PORT projectservice.wsgi'
liveness_check:
path: "/_hc"
check_interval_sec: 30
timeout_sec: 4
failure_threshold: 2
success_threshold: 2
handlers:
# This configures Google App Engine to serve the files in the app's
# static directory.
- url: /static
static_dir: static/
# This handler routes all requests not caught above to the main app.
# It is required when static routes are defined, but can be omitted
# (along with the entire handlers section) when there are no static
# files defined.
- url: /.*
script: auto
# [END django_app]
这很好,但是您需要为
/\uhc
提供一个url处理程序,该处理程序返回200
响应:
from django.http import HttpResponse
def health_check_handler(request):
return HttpResponse("healthy", content_type='text/plain')
在URL.py中:
(r'^_hc$', 'health_check_handler'),
这很好,但是您需要为
/\uhc
提供一个url处理程序,该处理程序返回200
响应:
from django.http import HttpResponse
def health_check_handler(request):
return HttpResponse("healthy", content_type='text/plain')
在URL.py中:
(r'^_hc$', 'health_check_handler'),
可能使用这个:并添加/_hc作为健康检查的url。这个包对健康检查数据库、缓存和ETC有不同的模式。我们可以使用:和添加/_hc作为健康检查的url。这个软件包有不同的健康检查模式,数据库,缓存等。这不总是给出200的响应吗?如果应用程序可以运行,是的。Per docs:“活动性检查确认VM和Docker容器正在运行。被视为不健康的实例将重新启动。”这不总是会给出200个响应吗?如果应用程序可以运行,是的。Per docs:“活动性检查确认VM和Docker容器正在运行。被认为不健康的实例将重新启动。”