Skip to main content

Django-easy-health-check

Django-easy-health-check is a Django package that provides an easy-to-use middleware to allow health check.

Motivation

Django's ALLOWED_HOSTS setting often would prevent health check from being completed successfully in production. A common method of getting around this involves making a request to fetch ip address about the instance itself and adding it to the ALLOWED_HOSTS. This approach often varies depending on deployment platform/environment.

This package provides a simple middleware that allows requests to a specified health check path to be made without checking against ALLOWED_HOSTS setting. This negates the need to modify ALLOWED_HOSTS setting in runtime, and is therefore platform-agnostic.

Quick start

Install using pip:

pip install django-easy-health-check

Or, install from source:

pip install git+https://github.com/oscarychen/django-easy-health-check.git

Add the health check middleware to Django settings before django.middleware.common.CommonMiddleware:

MIDDLEWARE = [
    ...,
    'easy_health_check.middleware.HealthCheckMiddleware',
    'django.middleware.common.CommonMiddleware',
    ...
]

By default, the health check url will be available at "example.com/healthcheck/".

Settings

You can customize and overwrite the default settings by including the following in your project's settings.py:

DJANGO_EASY_HEALTH_CHECK = {
    "PATH": "/healthcheck/",
    "RETURN_STATUS_CODE": 200,
    "RETURN_BYTE_DATA": "",
    "RETURN_HEADERS": None
}

In production, you may also want to set the following Django settings:

ALLOWED_HOSTS = ["example.com"]
SECURE_SSL_REDIRECT = True
SECURE_REDIRECT_EXEMPT = [r'^healthcheck/$']

Metadata

Release files for django-easy-health-check 1.0.1

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-easy-health-check 1.0.1
File Size Uploaded Provenance
django-easy-health-check-1.0.1.tar.gz 3.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for django-easy-health-check 1.0.1
File Interpreter ABI Platform
django_easy_health_check-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 7.0 kB

Release files / django-easy-health-check-1.0.1.tar.gz

Download URL django-easy-health-check-1.0.1.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
51b940af823d8fce6c5bd9a41e7d6444dc2d951719a13bd837f585957137b394
BLAKE2b-256 checksum
How to use checksums
dd5bac341a51649c76859c95c0ba5c47819239e3b28a8c8e4584130cc60dc90e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.6.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

Release files / django_easy_health_check-1.0.1-py3-none-any.whl

Download URL django_easy_health_check-1.0.1-py3-none-any.whl
Size 3.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
462c8e6ced490a87343557f52bf8e68072668c5d03194c310ad30724df8273b3
BLAKE2b-256 checksum
How to use checksums
ed271439ef99e3eb7d8f4c10910c8fb6834527781c740c13dfac18c2d1eb1348
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.6.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

Security for django-easy-health-check 1.0.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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