Skip to content

Django app that provides a simple command to wait for the database to be ready before starting the server.

License

Notifications You must be signed in to change notification settings

enzofrnt/django_wait_for_db

Repository files navigation

codecov

django_wait_for_db

Django app that provides a simple command to wait for the database to be ready before starting the server.

Installation

Install the package using pip:

pip install django_wait_for_db

Usage

Add django_wait_for_db to your INSTALLED_APPS:

INSTALLED_APPS = [
    ...
    'wait_for_db',
    ...
]

Then run the following command:

python manage.py wait_for_db

This will wait for the database to be ready before starting the server. This is useful when you are using Docker and you want to start the Django server before the database is ready or when you are in an environment where the database is not always available when the Django server starts.

Exemple of a Dockerfile:

FROM python:3.8

(.......)

CMD python manage.py wait_for_db \
    && python manage.py runserver

About

Django app that provides a simple command to wait for the database to be ready before starting the server.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages