{"id":2476,"library":"django-health-check","title":"Django HealthCheck","description":"Django HealthCheck is a plug-and-play Django application that provides a /healthcheck/ endpoint to monitor the health of your Django app and its connected services like databases, caches, storage, Celery, and more. It returns HTTP 200 for healthy status and HTTP 500 if issues are detected. The current version is 4.2.2, and it maintains a regular release cadence with frequent updates and bug fixes.","status":"active","version":"4.2.2","language":"en","source_language":"en","source_url":"https://github.com/codingjoe/django-health-check","tags":["django","health check","monitoring","devops","liveness","readiness"],"install":[{"cmd":"pip install django-health-check","lang":"bash","label":"Install core package"},{"cmd":"pip install django-health-check[psutil,celery,redis]","lang":"bash","label":"Install with common optional dependencies"}],"dependencies":[{"reason":"Required Python version.","package":"python","version":">=3.10","optional":false},{"reason":"Enables disk and memory utilization checks (health_check.contrib.psutil).","package":"psutil","optional":true},{"reason":"Enables Celery task queue checks (health_check.contrib.celery, health_check.contrib.celery_ping).","package":"celery","optional":true},{"reason":"Enables Redis connection checks (health_check.contrib.redis).","package":"redis","optional":true},{"reason":"Enables Kafka checks (health_check.contrib.kafka).","package":"kafka-python","optional":true},{"reason":"Enables RabbitMQ checks (health_check.contrib.rabbitmq).","package":"pika","optional":true},{"reason":"Enables RSS/Atom feed checks (e.g., cloud provider status via health_check.contrib.rss).","package":"feedparser","optional":true}],"imports":[{"note":"The core app name for django-health-check is 'health_check', not 'django_healthchecks' which is a different library or older package structure.","wrong":"INSTALLED_APPS = ['django_healthchecks']","symbol":"health_check","correct":"INSTALLED_APPS = [\n    # ...\n    'health_check', # required\n    'health_check.db', # database check\n    'health_check.cache', # cache check\n    'health_check.storage', # storage check\n    'health_check.contrib.celery', # optional, for Celery\n    'health_check.contrib.psutil', # optional, for disk/memory\n    # ...\n]"},{"symbol":"include","correct":"from django.urls import include, path\n\nurlpatterns = [\n    # ...\n    path('health/', include('health_check.urls')), # or any desired path\n    # ...\n]"},{"note":"Registering custom health checks, typically in your app's ready() method.","symbol":"plugin_dir.register","correct":"from django.apps import AppConfig\nfrom health_check.plugins import plugin_dir\nfrom myapp.checks import MyCustomHealthCheck\n\nclass MyAppConfig(AppConfig):\n    name = 'myapp'\n    def ready(self):\n        plugin_dir.register(MyCustomHealthCheck)"}],"quickstart":{"code":"# settings.py\nINSTALLED_APPS = [\n    # ... other Django apps ...\n    'health_check',\n    'health_check.db', # Checks database connection\n    'health_check.cache', # Checks cache backend\n    'health_check.storage', # Checks default file storage\n    'health_check.contrib.psutil', # Checks disk/memory usage (requires psutil)\n    'health_check.contrib.celery', # Checks Celery workers (requires celery)\n    # Add more health_check.contrib.* apps as needed for your services\n]\n\n# urls.py\nfrom django.urls import include, path\n\nurlpatterns = [\n    # ... other url patterns ...\n    path('health/', include('health_check.urls')),\n]","lang":"python","description":"To quickly integrate Django HealthCheck, add the 'health_check' core app and any desired `health_check.contrib.*` plugins to your `INSTALLED_APPS`. Then, include the health check URLs in your project's `urls.py`. Remember to install extra dependencies for specific checks (e.g., `psutil` for disk/memory checks)."},"warnings":[{"fix":"Consult the official migration guide for `django-health-check` when upgrading.","message":"Version 4.x introduced significant changes, particularly affecting custom integrations and the overall API. Review the 'Migration to v4.x' guide in the official documentation when upgrading from versions prior to 4.0.","severity":"breaking","affected_versions":"<4.0 to 4.x"},{"fix":"Install optional dependencies using `pip install django-health-check[extra_package_name]` (e.g., `pip install django-health-check[psutil]`) or install the specific package directly (e.g., `pip install psutil`).","message":"Many specific health checks (`health_check.contrib.*`) require additional Python packages to be installed (e.g., `psutil` for disk/memory, `celery` for Celery, `redis` for Redis). Simply adding the contrib app to `INSTALLED_APPS` without the underlying package will cause errors.","severity":"gotcha","affected_versions":"All versions"},{"fix":"If you relied on this check, you may need to implement a custom check or find an alternative monitoring solution for database migrations.","message":"The `health_check.contrib.migrations` check, which verified applied database migrations, was removed in version 3.23+.","severity":"deprecated","affected_versions":">=3.23"},{"fix":"Generate a separate, strong secret token for the health check URL (e.g., using `secrets.token_urlsafe()`) and configure your URL accordingly. Ensure HTTPS is enabled.","message":"For security, it is highly recommended to protect your health check endpoint, especially in production environments. If using a token-based approach, do NOT use Django's `SECRET_KEY`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Account for node-specific responses in your monitoring strategy or consider aggregate metrics from a dedicated monitoring system.","message":"In high-availability environments with load balancers, be aware that checks like disk and memory usage will return responses specific to the individual node selected by the load balancer, not an aggregated status of the entire cluster.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-10T00:00:00.000Z","next_check":"2026-07-09T00:00:00.000Z"}