Skip to main content

django-healthchecks

https://img.shields.io/pypi/v/django-healthchecks.svg https://github.com/labd/django-healthchecks/actions/workflows/python-test.yml/badge.svg

Simple Django app/framework to publish health check for monitoring purposes

Features:

  • Custom checks via Python functions

  • Remote healthchecks

  • Heartbeat monitoring

Installation

pip install django_healthchecks

Usage

Add the following to your urls.py:

url(r'^healthchecks/', include('django_healthchecks.urls')),

Add a setting with the available healthchecks:

HEALTH_CHECKS = {
    'postgresql': 'django_healthchecks.contrib.check_database',
    'cache_default': 'django_healthchecks.contrib.check_cache_default',
    'solr': 'your_project.lib.healthchecks.check_solr',
}

You can also include healthchecks over http. This is useful when you want to monitor if depending services are up:

HEALTH_CHECKS = {
    ...
    'my_microservice': 'https://my-service.services.internal/healthchecks/',
    ...
}

By default, http health checks will time out after 500ms. You can override this as follows:

HEALTH_CHECKS_HTTP_TIMEOUT = 0.5

By default the status code is always 200, you can change this to something else by using the HEALTH_CHECKS_ERROR_CODE setting:

HEALTH_CHECKS_ERROR_CODE = 503

You can also add some simple protection to your healthchecks via basic auth. This can be specified per check or a wildcard can be used *.

HEALTH_CHECKS_BASIC_AUTH = {
    '*': [('admin', 'pass')],
    'solr': [],
}

Using heartbeats

Heartbeats give a periodic update, to see whether an service was recently active. When the service doesn’t report back within timeout, a healthcheck can be triggered. To use heartbeats, add the application to the INSTALLED_APPS:

INSTALLED_APPS = [
    ...
    "django_healthchecks",
]

Include one of these checks:

HEALTH_CHECKS = {
    ...
    'heartbeats': 'django_healthchecks.contrib.check_heartbeats'
    ...
    'expired_heartbeats': 'django_healthchecks.contrib.check_expired_heartbeats',
    ...
}

Optionally, define an initial timeout:

HEALTHCHECKS_DEFAULT_HEARTBEAT_TIMEOUT = timedelta(days=1)

Let your code track the beats:

from datetime import timedelta
from django_healthchecks.heartbeats import update_heartbeat

update_heartbeat("myservice.name", default_timeout=timedelta(days=2))

Or use the decorator:

from django_healthchecks.heartbeats import update_heartbeat_on_success

@update_heartbeat_on_success("myservice.name", default_timeout=...)
def long_running_task():
    ....

Each time update_heartbeat() is called, the heartbeat is reset. When a heartbeat didn’t receive an update before it’s timeout, the service name be mentioned in the check_expired_heartbeats check.

Updating timeouts

The default_timeout parameter is only assigned upon creation. Any updates happen through the Django admin. To update the timeout automatically on code deployment, use the timeout parameter instead. This will replace the stored timeout value each time the update_heartbeat() function is called, erasing any changes made in the Django admin.

Releasing

Changes are tracked with changie. Add a changelog entry to every pull request with a user-facing change:

changie new

When entries are merged to the default branch, a release pull request is opened (or updated) automatically. Merging that pull request tags the release, creates the GitHub release and publishes the package to PyPI.

Metadata

Release files for django-healthchecks 1.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-healthchecks 1.6.0
File Size Uploaded Provenance Actions
django_healthchecks-1.6.0.tar.gz 13.6 kB With provenance Details for django_healthchecks-1.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-healthchecks 1.6.0
File Interpreter ABI Platform Actions
django_healthchecks-1.6.0-py3-none-any.whl Python 3 none any Details for django_healthchecks-1.6.0-py3-none-any.whl

Total release size: 25.4 kB

Release files / django_healthchecks-1.6.0.tar.gz

Download URL django_healthchecks-1.6.0.tar.gz
Size 13.6 kB
Tags Source
SHA-256 checksum
How to use checksums
78ea78d6f52ac7a2e815af2d633f62cb23d4beec35db90ae2b97bbb6c2997e05
BLAKE2b-256 checksum
How to use checksums
99bcdfda75db6567e5819475160409c9b39386ec7b4cc522e993761a9403ed89
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.

Transparency log

Release files / django_healthchecks-1.6.0-py3-none-any.whl

Download URL django_healthchecks-1.6.0-py3-none-any.whl
Size 11.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
270d03127552f5f8dc962305b5e04beb053b5cdc66e9b8f1688089f177494e0a
BLAKE2b-256 checksum
How to use checksums
6917070ad26dafc1a1c7f08f07aa7b0e930a72f264eae70272428da61829621c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.

Transparency log

Security for django-healthchecks 1.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for django_healthchecks-1.6.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page