Skip to content

Commit

Permalink
DBC22-2057: healthcheck endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
ray-oxd authored and fatbird committed May 1, 2024
1 parent e888956 commit 5814477
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/backend/apps/shared/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from django.core.exceptions import ImproperlyConfigured
from django.core.mail import send_mail
from django.db import connection
from django.http import HttpResponse
from django.urls import re_path
from django.views.static import serve
from drf_recaptcha.fields import ReCaptchaV3Field
Expand Down Expand Up @@ -56,6 +57,10 @@ def post(self, request):
return Response(data={}, status=status.HTTP_400_BAD_REQUEST)


def health_check(response):
return HttpResponse('Ok')


class CachedListModelMixin:
"""
List a queryset. Result is fetched from cache or updates it if it doesn't exist.
Expand Down
6 changes: 5 additions & 1 deletion src/backend/config/urls.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from apps.shared import views as shared_views
from apps.shared.views import static_override
from django.conf import settings
from django.contrib import admin
Expand All @@ -13,11 +14,14 @@
# packages
path('drivebc-cms/', include("apps.cms.urls")),

# misc
path("healthcheck/", shared_views.health_check, name="health_check"),

# TO BE REMOVED IN PRODUCTION
] + static_override(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

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

0 comments on commit 5814477

Please sign in to comment.