With our open source django_auto_healthchecks app you can define powerful healthchecks for your Django application directly in your
urls.py.
django_auto_healthchecks app in your Django projectdjango_auto_healthchecks package to your project.INSTALLED_APPS, add django_auto_healthchecks to the end of the list
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'example_app',
# Django auto healthchecks should be the final app in your list
'django_auto_healthchecks'
]
HEALTHCHECKS configuration
HEALTHCHECKS = {
# The api key is required
'API_KEY': '60d12a7093c9465398de00bd75a2b54d',
# These are optional:
'HTTPS': True,
'TAGS': ['Demo App', 'Mysite']
}
from django_auto_healthchecks import url, Healthcheck
url(r'^api/leads/(?P<lead>.+)$',
views.api,
name='leads-detail',
healthcheck=Healthcheck(
kwargs={'lead': '12345'},
name='Lead API Update',
method='PUT',
body='{"name": "Spacely Sprockets", "contact": "Cosmo Spacely"}',
assertions=[{
'rule_type': 'response_body',
'operator': 'contains',
'value': 'Cosmo',
}]))
settings.DEBUG = True healthchecks are published to Cronitor in Development mode.
settings.DEBUG = False, production monitors will be published automatically.
Cronitor automatically runs all healthchecks when they are deployed. Cronitor will continue to monitor your Django application and alert you
if it becomes unreachable or any of your custom assertions fail.
If your Django application is deployed to multiple servers or is otherwise high availability, you can choose to control when
healthchecks are published to Cronitor by removing django_auto_healthchecks from INSTALLED_APPS.
Call django_auto_healthchecks.put() from a custom admin view or a custom django-admin command to publish healthchecks on demand.
The open source django_auto_healthchecks app is currently in beta. We love
feedback,
bug reports, and
contributions.