Skip to content

Commit 83179a0

Browse files
Read VERSION from settings in health endpoint
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent d003de7 commit 83179a0

1 file changed

Lines changed: 2 additions & 16 deletions

File tree

data/views/health.py

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,10 @@
44
Provides a simple health check that returns the current application version.
55
"""
66

7-
import os
8-
import tomllib
9-
from pathlib import Path
10-
7+
from django.conf import settings
118
from django.http import JsonResponse
129

1310

14-
def get_version():
15-
"""Read version from pyproject.toml."""
16-
pyproject_path = Path(__file__).parent.parent.parent / "pyproject.toml"
17-
try:
18-
with open(pyproject_path, "rb") as f:
19-
data = tomllib.load(f)
20-
return data.get("project", {}).get("version", "unknown")
21-
except Exception:
22-
return "unknown"
23-
24-
2511
def health_view(request):
2612
"""
2713
Health check endpoint that returns the current version.
@@ -31,5 +17,5 @@ def health_view(request):
3117
"""
3218
return JsonResponse({
3319
"status": "ok",
34-
"version": get_version(),
20+
"version": getattr(settings, "VERSION", "unknown"),
3521
})

0 commit comments

Comments
 (0)