Test whether access to the database is possible
Project description
Django-probes
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.