Skip to main content

Test whether access to the database is possible

Project description

Django-probes Latest version on PyPI

Build status Python versions Software license

This python package provides a management to check whether the database is ready

Installation

The easiest way to install django-probes is with pip

$ pip install django-probes

Basic Usage

Add django-probes to your Django application:

INSTALLED_APPS = [
    ...
    'django_probes',
]

Add an initContainer to your Kubernetes/OpenShift deployment configuration, which calls the wait_for_database management command:

- kind: Deployment
  apiVersion: apps/v1
  spec:
    template:
      spec:
        initContainers:
        - name: check-db-ready
          image: my-django-app:latest
          envFrom:
          - secretRef:
            name: django
          command: ['python', 'manage.py', 'wait_for_database']

Command Line Options

The management command has sane default, which you can override to your liking.

–timeout, -t:

how long to wait (seconds), default: 180

–stable, -s:

how long to observe whether connection is stable (seconds), default: 4

–wait-when-alive, -a:

delay between checks when database is up (seconds), default: 1

–wait-when-down, -d:

delay between checks when database is down (seconds), default: 1

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

django_probes-1.0.4.tar.gz (4.2 kB view hashes)

Uploaded Source

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