chore: initial commit of Wagtail backend scaffold

This commit is contained in:
2026-08-06 15:56:14 +08:00
commit 7f51a31150
51 changed files with 1239 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
"""
健康检查端点,供 Kubernetes liveness/readiness 探针使用。
详见 documents/设计方案分析与完善版.md §2.12。
"""
from django.db import connection
from django.http import JsonResponse
def healthz(request):
"""存活探针:仅确认进程可响应请求。"""
return JsonResponse({"status": "ok"})
def readyz(request):
"""就绪探针:确认数据库连接可用。"""
try:
with connection.cursor() as cursor:
cursor.execute("SELECT 1")
except Exception as exc: # pragma: no cover - defensive
return JsonResponse({"status": "error", "detail": str(exc)}, status=503)
return JsonResponse({"status": "ok"})