Skip to content

Commit 5814477

Browse files
ray-oxdfatbird
authored andcommitted
DBC22-2057: healthcheck endpoint
1 parent e888956 commit 5814477

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/backend/apps/shared/views.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from django.core.exceptions import ImproperlyConfigured
99
from django.core.mail import send_mail
1010
from django.db import connection
11+
from django.http import HttpResponse
1112
from django.urls import re_path
1213
from django.views.static import serve
1314
from drf_recaptcha.fields import ReCaptchaV3Field
@@ -56,6 +57,10 @@ def post(self, request):
5657
return Response(data={}, status=status.HTTP_400_BAD_REQUEST)
5758

5859

60+
def health_check(response):
61+
return HttpResponse('Ok')
62+
63+
5964
class CachedListModelMixin:
6065
"""
6166
List a queryset. Result is fetched from cache or updates it if it doesn't exist.

src/backend/config/urls.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from apps.shared import views as shared_views
12
from apps.shared.views import static_override
23
from django.conf import settings
34
from django.contrib import admin
@@ -13,11 +14,14 @@
1314
# packages
1415
path('drivebc-cms/', include("apps.cms.urls")),
1516

17+
# misc
18+
path("healthcheck/", shared_views.health_check, name="health_check"),
19+
1620
# TO BE REMOVED IN PRODUCTION
1721
] + static_override(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
1822

1923
if settings.DEV_ENVIRONMENT:
2024
from django.views.static import serve
2125
urlpatterns.append(re_path(r"^images/(?P<path>.*)$", serve, {
2226
"document_root": f'{settings.SRC_DIR}/images/webcams',
23-
}))
27+
}))

0 commit comments

Comments
 (0)