Initial deploy setup
deploy / deploy (push) Canceled after 0s

This commit is contained in:
Jens
2026-07-21 14:00:00 +02:00
commit b8091e59bd
285 changed files with 27854 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
from __future__ import annotations
from dataclasses import asdict, dataclass
from django.db import connections
from django.db.utils import OperationalError
@dataclass(frozen=True)
class HealthResult:
ok: bool
checks: dict[str, str]
def to_dict(self) -> dict[str, object]:
return asdict(self)
def readiness() -> HealthResult:
checks: dict[str, str] = {}
ok = True
try:
with connections["default"].cursor() as cursor:
cursor.execute("SELECT 1")
cursor.fetchone()
checks["database"] = "ok"
except OperationalError as exc:
ok = False
checks["database"] = f"error:{exc.__class__.__name__}"
return HealthResult(ok=ok, checks=checks)