Fact Box |
|
---|---|
Language | Python |
License | MIT |
GitHub | revsys/django-health-check |
PyPI | django-health-check |
First Release | 2013 |
Status | Active (now maintained by REVSYS) |
Downloads | 1M+ monthly |
django-health-check is a pluggable Django application that provides comprehensive health monitoring for your deployment. It enables you to verify that critical components of your application are functioning correctly through a simple HTTP endpoint.
Origin Story
I created django-health-check out of necessity while building production Django applications. When running applications at scale, you need a reliable way to monitor whether your services are healthy - not just if the web server is responding, but whether the database is reachable, cache is working, Celery tasks are processing, and other critical components are operational.
The project was designed with a plugin architecture from the start, making it easy to add custom health checks for any service your application depends on.
Features
The library comes with several built-in health checks:
- Database: Verifies database connectivity and performs a simple query
- Cache: Tests cache backend functionality
- Storage: Checks file storage backends
- Disk & Memory: Monitors system resources via psutil
- Celery: Validates Celery worker availability and task queue health
- RabbitMQ: Tests message broker connectivity
- AWS S3: Verifies S3 storage access
How It Works
Once configured, django-health-check exposes a /ht/
endpoint (configurable) that runs all registered health checks. The endpoint returns:
- HTTP 200: All checks passed - system is healthy
- HTTP 500: One or more checks failed - system needs attention
The response includes detailed information about which checks passed or failed, making it easy to diagnose issues quickly.
Integration with Monitoring
The health check endpoint is perfect for integration with:
- Load balancers (ALB, ELB, nginx)
- Container orchestration (Kubernetes liveness/readiness probes)
- Monitoring services (Datadog, New Relic, etc.)
- Uptime monitoring (Pingdom, UptimeRobot)
Community & Maintenance
After building the initial version, I transferred the project to REVSYS, who have done an excellent job maintaining and extending it. The project has grown to over 1 million monthly downloads on PyPI and is used in production by thousands of Django applications worldwide.
The plugin architecture has enabled the community to contribute additional health check backends, covering a wide range of services and infrastructure components.
Why It Matters
Health checks are often an afterthought, but they're critical for production reliability. A proper health check can:
- Prevent bad deployments from receiving traffic
- Enable automatic recovery by allowing orchestrators to restart unhealthy instances
- Provide early warning of degraded services
- Reduce mean time to detection (MTTD) for incidents
django-health-check makes implementing comprehensive health monitoring straightforward, allowing you to focus on building your application rather than reinventing health check infrastructure.