diff --git a/hc/api/urls.py b/hc/api/urls.py index d726802f..da2a6874 100644 --- a/hc/api/urls.py +++ b/hc/api/urls.py @@ -12,4 +12,5 @@ urlpatterns = [ name="hc-api-bounce"), url(r'^badge/([\w-]+)/([\w-]{8})/([\w-]+).svg$', views.badge, name="hc-badge"), + url(r'^api/v1/status/$', views.status), ] diff --git a/hc/api/views.py b/hc/api/views.py index 63ad58d1..177016c2 100644 --- a/hc/api/views.py +++ b/hc/api/views.py @@ -1,5 +1,6 @@ from datetime import timedelta as td +from django.db import connection from django.db.models import F from django.http import (HttpResponse, HttpResponseForbidden, HttpResponseNotFound, JsonResponse) @@ -185,3 +186,11 @@ def bounce(request, code): notification.save() return HttpResponse() + + +def status(request): + with connection.cursor() as c: + c.execute("SELECT 1") + c.fetchone() + + return HttpResponse("OK")