Skip to content

toggle-corp/toggle-django-utils

Repository files navigation

toggle-django-utils

Reusable Django utilities and management commands for Toggle projects.


Features

  • Shared management command: wait_for_resources — Wait for database, Redis, Minio (S3) resources to be available before startup

Installation

Using uv:

uv pip install "git+ssh://git@github.com/toggle-corp/toggle-django-utils.git@main"

Or add to your pyproject.toml:

[project]
dependencies = [
    "toggle-django-utils",
]

[tool.uv.sources]
toggle-django-utils = { git = "ssh://git@github.com/toggle-corp/toggle-django-utils", branch = "main" }

Setup in Django

  1. Add to INSTALLED_APPS in your Django project's settings.py:

    INSTALLED_APPS = [
        # ... your other apps ...
        "toggle_django_utils",
    ]
  2. (Optional) If your settings.py uses custom configs, ensure "toggle_django_utils" remains in the app list.


Usage

Access the management command:

python manage.py wait_for_resources --db --redis

Command options:

  • --db      Wait for database
  • --redis   Wait for Redis server
  • --minio   Wait for Minio (S3 storage)
  • --timeout   Set max wait time (seconds)

Examples:

python manage.py wait_for_resources --db --redis
python manage.py wait_for_resources --timeout 300 --minio

Development

  1. Clone the repository
  2. Install as editable with uv:
    uv sync --all-groups --all-extras
  3. Type checking
    uv run --all-groups --all-extras pyright
  4. Running Tests
    uv run --all-groups --all-extras pytest

License

Apache-2.0

About

Shared Django utilities and management commands for Toggle projects.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages