Skip to main content

Django Status

Version:

2.2.1

Status:

Production/Stable

Author:

José Antonio Perdiguero López

Django Status is an application that provides an API to check the status of some parts and some utilities like ping requests. This application can works as standalone or included in a Django project.

Quick start

  1. Install this package using pip:

    pip install django-status
  2. Add PROJECT_PATH to your django settings module.

  3. Add status to your INSTALLED_APPS settings like this:

    INSTALLED_APPS = (
        ...
        'status',
    )
  4. Add Django-status urls to your project urls:

    urlpatterns = [
        ...
        url(r'^status/', include('status.urls')),
    ]

Check Providers

Django Status provides a mechanism to add new custom check functions through check providers. Each check provider will generate a new API method with an URL that uses the name of the provider. These functions must accept *args and **kwargs and will return a JSON-serializable object through json.dumps() method, for example a ping function:

def ping(*args, **kwargs):
    return {'pong': True}

By default Django status provides the follow checks:

Ping

A ping to application. URL: /api/health/ping

Databases

Check if databases are running. URL: /api/health/databases

Caches

Check if caches are running. URL: /api/health/caches

Celery

Check if celery workers defined in settings are running. URL: /api/health/celery

Databases stats

Show stats for all databases. URL: /api/stats/databases

Celery stats

Show celery worker stats. URL: /api/stats/celery

Code

Source code stats such as current active branch, last commit, if debug is active… URL: /api/stats/code

Django Status website

A website that shows Django Status data is available in this application. It’s possible access to follow URLs to get a detailed view of your system status. Those three pages will show results of providers configured (as explained in settings section):

http://www.website.com/status/
http://www.website.com/status/health/
http://www.website.com/status/stats/

Django Status API

Django Status API can be used as a standalone application including only their urls:

urlpatterns = [
    ...
    url(r'^status/', include('status.api.urls')),
]

This API have a single url for each provider, that are grouped by resources. Each provider can be queried alone, returning his current status:

http://your_domain/status/api/health/ping

Also there is a resource view that will return the status of all providers:

http://your_domain/status/api/health

For last, there is a root view that will return the status of all providers from all resources:

http://your_domain/status/api

Django management commands

Django Status provides a django management command to query current status of a resource. This command can be call as:

python manage.py status <resource> [options]

To get current status of health checks, and exit with an error if some check is failing:

python manage.py status health -e

Each resource has its own set of options that can be displayed through command help:

python manage.py status -h

Command

Previous Django command can be used in standalone mode as:

django_status <resource> [options]

Settings

STATUS_CHECK_PROVIDERS

List of additional check providers. Each provider consists in a tuple of name, function complete path, args and kwargs. Example:

STATUS_PROVIDERS = {
    'resource': (
        ('test', 'application.module.test_function', [1, 2], {'foo': 'bar'}),
    )
}

Default:

PROVIDERS = getattr(settings, 'STATUS_PROVIDERS', {
    'health': (
        ('ping', 'status.providers.health.ping', None, None),
        ('databases', 'status.providers.django.health.databases', None, None),
        ('caches', 'status.providers.django.health.caches', None, None),
    ),
    'stats': (
        ('databases', 'status.providers.django.stats.databases', None, None),
        ('code', 'status.providers.stats.code', None, None),
    )
}

STATUS_CELERY_WORKERS

List of hostname from celery workers to be checked. If any worker is defined, two additional providers listed previously will be added to default set. Default:

STATUS_CELERY_WORKERS = ()

Metadata

Release files for django-status 2.2.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-status 2.2.1
File Size Uploaded Provenance
django-status-2.2.1.tar.gz 899.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for django-status 2.2.1
File Interpreter ABI Platform
django_status-2.2.1-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 1.8 MB

Release files / django-status-2.2.1.tar.gz

Download URL django-status-2.2.1.tar.gz
Size 899.4 kB
Tags Source
SHA-256 checksum
How to use checksums
7a62715663060c4f3937273383fe65f56efd4182e0274581ac78851288292e5b
BLAKE2b-256 checksum
How to use checksums
1f2c80a183a46b33afa965f01d39ef5b29a57563d85e0759ca66987230d22a3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / django_status-2.2.1-py2.py3-none-any.whl

Download URL django_status-2.2.1-py2.py3-none-any.whl
Size 928.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
b4f77fe565c2813f179d917b7024de333d794b92fe8c780846a1499ec976c776
BLAKE2b-256 checksum
How to use checksums
93deb88996d261fccb93ef33ab3e1ee6290ffc088b8357017527b87d05af5ea7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for django-status 2.2.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.

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