Reusable Django utilities and management commands for Toggle projects.
- Shared management command:
wait_for_resources— Wait for database, Redis, Minio (S3) resources to be available before startup
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" }-
Add to
INSTALLED_APPSin your Django project'ssettings.py:INSTALLED_APPS = [ # ... your other apps ... "toggle_django_utils", ]
-
(Optional) If your
settings.pyuses custom configs, ensure"toggle_django_utils"remains in the app list.
Access the management command:
python manage.py wait_for_resources --db --redisCommand options:
--dbWait for database--redisWait for Redis server--minioWait for Minio (S3 storage)--timeoutSet max wait time (seconds)
Examples:
python manage.py wait_for_resources --db --redis
python manage.py wait_for_resources --timeout 300 --minio- Clone the repository
- Install as editable with uv:
uv sync --all-groups --all-extras
- Type checking
uv run --all-groups --all-extras pyright
- Running Tests
uv run --all-groups --all-extras pytest
Apache-2.0