From 8f8611e6aedbbab8502c34377cf6805dcfe621a4 Mon Sep 17 00:00:00 2001 From: Jake Low Date: Tue, 24 Sep 2024 13:46:00 -0700 Subject: [PATCH] Move /health endpoint to /api/v1/health (making it public) (#716) This allows us to monitor the API health more easily from a remote service such as updown.io. --- config/urls.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/config/urls.py b/config/urls.py index a39a3725..25a28151 100644 --- a/config/urls.py +++ b/config/urls.py @@ -8,6 +8,7 @@ from django.views import defaults from django.views import static as static_views from django.http import JsonResponse +from django.shortcuts import redirect from rest_framework import permissions from drf_yasg.views import get_schema_view @@ -59,6 +60,9 @@ permission_classes=(permissions.AllowAny,), ) +def health_redirect(request): + return redirect(API_BASE_URL + 'health') + def health_check(request): return JsonResponse({'status': 'ok'}) @@ -66,7 +70,8 @@ def health_check(request): # Django Admin path('admin/', admin.site.urls), - path('health', health_check), + path('health', health_redirect), + path(API_BASE_URL + 'health', health_check), # api docs re_path(