Skip to main content

Django views plugin for simple-health-checks, adds endpoints for ping and health checks

Project description

Django Views Plugin for Simple Health Checks

Provides 2 views that can be added to a django projects urls

Simply add the following to your urls file in your django project:

from simple_health_checks.urls import HEALTH_CHECK, PING

urlpatterns = [
    ...
    HEALTH_CHECK,
    PING,
]

Alternatively you can use the following but the middleware skip will not be active unless your ping url matches HEALTH_CHECKS_PING_PATH:

from simple_health_checks.views.views import HealthCheck, ping

urlpatterns = [
    ...
    url(r'^health/', HealthCheck.as_view(), name="health"),
    url(r'^ping/', ping, name="ping"),
]

To ensure that we skip middleware you MUST add "simple_health_checks.middleware.SkipMiddlewarePing" to the top of MIDDLEWARE in your django settings file.

Required environment variables

HEALTH_CHECKS_CRITICAL_ON_PING - used for resources that may hang when down but prevent the service from functioning. This can be used to force a proxy that monitors this endpoint to display a service down error and prevent future requests until it recovers. Comma separated resource names, matching the filename that defines the resource.

HEALTH_CHECKS_TOKEN - token used to gain access to more detailed information from the health endpoint

HEALTH_CHECKS_PING_PATH (Optional) - can be used to define a the ping uri if you wish to use from simple_health_checks.urls import HEALTH_CHECK, PING with a custom path

HEALTH_CHECKS_HEALTH_PATH (Optional) - can be used to define the health uri if you wish to use from simple_health_checks.urls import HEALTH_CHECK, PING with a custom path

PING_PATH is also used to ensure that when the ping endpoint is used we skip any django middleware that may try to communicate with a resource that may hang and cause an issue for the ping endpoint responding.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

File details

Details for the file simple_health_checks_django_views-1.0.2.tar.gz.

File metadata

  • Download URL: simple_health_checks_django_views-1.0.2.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.15

File hashes

Hashes for simple_health_checks_django_views-1.0.2.tar.gz
Algorithm Hash digest
SHA256 e1891c32b5946d4a13d6f94975573f54f040ae949a265fd6a459ee8d2b3fbfac
MD5 1e05d95e1a9eb43ecd6c2c376b757baf
BLAKE2b-256 43cbce369831b45a8a7c0d202c0268e74f8a1509fc4a8361ada578bea99d9c6c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page