# 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:
```bash
pip install django_wait_for_db
```
## Usage
Add `django_wait_for_db` to your `INSTALLED_APPS`:
```python
INSTALLED_APPS = [
...
'wait_for_db',
...
]
```
Then run the following command:
```bash
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:
```Dockerfile
FROM python:3.8
(.......)
CMD python manage.py wait_for_db \
&& python manage.py runserver
```
Raw data
{
"_id": null,
"home_page": null,
"name": "django-wait-for-db",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.8",
"maintainer_email": null,
"keywords": "django and docker, django database, database, wait for db",
"author": "enzo_frnt",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/f0/50/265e5065b6ea78e2f0f62d88b38760359023fddd92c2be31697d75e13e64/django_wait_for_db-1.0.5.tar.gz",
"platform": null,
"description": "# django_wait_for_db\n Django app that provides a simple command to wait for the database to be ready before starting the server.\n\n## Installation\n\nInstall the package using pip:\n\n```bash\npip install django_wait_for_db\n```\n\n## Usage\n\nAdd `django_wait_for_db` to your `INSTALLED_APPS`:\n\n```python\nINSTALLED_APPS = [\n ...\n 'wait_for_db',\n ...\n]\n```\n\nThen run the following command:\n\n```bash\npython manage.py wait_for_db\n```\n\nThis will wait for the database to be ready before starting the server.\nThis 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.\n\nExemple of a Dockerfile:\n\n```Dockerfile\nFROM python:3.8\n\n(.......)\n\nCMD python manage.py wait_for_db \\\n && python manage.py runserver\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Simple Django app that provides a simple command to wait for the database to be ready before starting the server.",
"version": "1.0.5",
"project_urls": {
"Documentation": "https://github.com/enzofrnt/django_wait_for_db/blob/main/README.md",
"Issues": "https://github.com/enzofrnt/django_wait_for_db/issues",
"Source Code": "https://github.com/enzofrnt/django_wait_for_db"
},
"split_keywords": [
"django and docker",
" django database",
" database",
" wait for db"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b26da8bc2975eb3588519f441c11c08e4979a78f119f9832a3b1e7bc79fd881b",
"md5": "6c0f41a55ab7669efeb649cd2f0af940",
"sha256": "642b896c627aa558590915edccb06b074f555a24f308ea9f4908d420b1a17be4"
},
"downloads": -1,
"filename": "django_wait_for_db-1.0.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6c0f41a55ab7669efeb649cd2f0af940",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.8",
"size": 5657,
"upload_time": "2024-09-07T20:25:16",
"upload_time_iso_8601": "2024-09-07T20:25:16.923061Z",
"url": "https://files.pythonhosted.org/packages/b2/6d/a8bc2975eb3588519f441c11c08e4979a78f119f9832a3b1e7bc79fd881b/django_wait_for_db-1.0.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f050265e5065b6ea78e2f0f62d88b38760359023fddd92c2be31697d75e13e64",
"md5": "ffdbe2d3ced4976488913f31c4f559eb",
"sha256": "6f82fea993e4bcfc275910d9c456b9aa4a7ccca201e976e5bdbb4a70053a077e"
},
"downloads": -1,
"filename": "django_wait_for_db-1.0.5.tar.gz",
"has_sig": false,
"md5_digest": "ffdbe2d3ced4976488913f31c4f559eb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.8",
"size": 5077,
"upload_time": "2024-09-07T20:25:17",
"upload_time_iso_8601": "2024-09-07T20:25:17.775421Z",
"url": "https://files.pythonhosted.org/packages/f0/50/265e5065b6ea78e2f0f62d88b38760359023fddd92c2be31697d75e13e64/django_wait_for_db-1.0.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-07 20:25:17",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "enzofrnt",
"github_project": "django_wait_for_db",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "django-wait-for-db"
}