This documents the code that allows Django integration.


The provided checks hook into Django’s system check framework to enable the heartbeat view to diagnose the current health of the Django project.

dockerflow.django.checks.check_database_connected(app_configs, **kwargs)[source]

A Django check to see if connecting to the configured default database backend succeeds.

dockerflow.django.checks.check_migrations_applied(app_configs, **kwargs)[source]

A Django check to see if all migrations have been applied correctly.

dockerflow.django.checks.check_redis_connected(app_configs, **kwargs)[source]

A Django check to connect to the default redis connection using django_redis.get_redis_connection and see if Redis responds to a PING command.


During the rendering of the /__heartbeat__ Django view two signals are being sent to hook into the result of the checks:


The signal that is sent when the heartbeat checks pass successfully.


The signal that is sent when the heartbeat checks raise either a warning or worse (error, critical)

Both signals receive an additional level parameter that indicates the maximum check level that failed during the rendering.

E.g. to hook into those signals to send data to statsd, do this:

from django.dispatch import receiver
from dockerflow.django.signals import heartbeat_passed, heartbeat_failed
from statsd.defaults.django import statsd

def heartbeat_passed_handler(sender, level, **kwargs):

def heartbeat_failed_handler(sender, level, **kwargs):


dockerflow.django implements various views so the automatic application monitoring can happen. They are mounted by including them in the root of a URL configration:

urlpatterns = [
    url(r'^', include('dockerflow.django.urls', namespace='dockerflow')),
    # ...

Runs all the Django checks and returns a JsonResponse with either a status code of 200 or 500 depending on the results of the checks.

Any check that returns a warning or worse (error, critical) will return a 500 response.


Let the load balancer know the application is running and available must return 200 (not 204) for ELB


Returns the contents of version.json or a 404.