How to monitor
A status page for your Django app
Monitor your Django app, API, Celery workers and database, watch SSL expiry, and publish a custom-domain status page — in minutes, with nothing to install.
A Django project usually has several moving parts that fail independently: the web app, the API, Celery workers, Celery beat, and the database. Monitoring each and rolling them into one status page gives you (and your users) a clear picture. Here's how — with nothing to install.
What to monitor in a Django app
- The web app — an HTTP check on your main URL with a keyword assertion.
- The API — a check on a
/health/endpoint (see how to monitor an API). - Celery workers & beat — heartbeats, so a stalled worker or scheduler pages you.
- The database — a query heartbeat and/or TCP check (see how to monitor PostgreSQL).
- SSL certificate — expiry monitoring (SSL guide).
Add a health view
# health/views.py
from django.db import connection
from django.http import JsonResponse
def health(request):
connection.ensure_connection() # touch the DB
return JsonResponse({"status": "ok"})
# urls.py
from health.views import health
urlpatterns += [path("health/", health)]
Point a StatusCat HTTP monitor at /health/ with a keyword assertion on "status":"ok". If the database is unreachable, the view errors and the monitor trips.
Monitor Celery with heartbeats
Add a periodic task that pings StatusCat, so a stalled worker or beat is caught:
# tasks.py
import requests
from celery import shared_task
@shared_task
def heartbeat():
requests.get("https://statuscat.co/ping/your-celery-id", timeout=10)
Schedule it via Celery beat every few minutes. If the ping stops arriving, StatusCat alerts you. (More in how to monitor a cron job.)
Publish the status page
- Group your monitors (web, API, workers, database).
- Create a status page and add them as components.
- Point it at
status.yourapp.com. - Enable email subscribers for incident updates.
StatusCat does all of this from the outside, free for 50 monitors, with on-call and status pages included. New to monitoring? Start with what uptime monitoring is. On Next.js or Laravel instead? See status page for Next.js and status page for Laravel.