Simple Django health check
Inspired by:
$ pip install django-simple-health-check
Use
pip install django-simple-health-check[psutil]
for usingsimple_health_check.checks.ps.*
checks.
-
Install the package
-
Add
simple_health_check
to your INSTALLED_APPS settings like this:
INSTALLED_APPS = [
...,
'simple_health_check',
...,
]
- Add
simple_health_check.urls
to mainurls.py
:
from django.urls import path, include
urlpatterns = [
...,
path('', include('simple_health_check.urls')),
...,
]
- Configure the readiness checks:
SIMPLE_HEALTH_CHECKS = {
'simple_health_check.checks.migrations.Migrations': [
dict(alias='default'),
dict(alias='db2'),
],
'simple_health_check.checks.db.Databases': None,
# The simplest way to add your own check
'your_package.path_to_checks.SomeCheck': {...} or [{...}, ...] or None,
}
by default
SIMPLE_HEALTH_CHECKS = {
'simple_health_check.checks.migrations.Migrations': None, # check all aliases
'simple_health_check.checks.db.Databases': None, # check all aliases
}
A check | Built-in/expected |
---|---|
simple_health_check.checks.db.Databases | ✔️ |
simple_health_check.checks.migrations.Migrations | ✔️ |
simple_health_check.checks.caches.CacheBackends | ✔️ |
simple_health_check.checks.ps.DiskUsage | ✔️ |
simple_health_check.checks.ps.MemoryUsage | ✔️ |
simple_health_check.checks.dummy.DummyTrue | ✔️ |
simple_health_check.checks.dummy.DummyFalse | ✔️ |
emails | ⏳ |
queues | ⏳ |
storages | ⏳ |
MIT