1- # toggle-django- utils
1+ # Banjo utils
22
33Reusable Django utilities and management commands for Toggle projects.
44
@@ -8,43 +8,42 @@ Reusable Django utilities and management commands for Toggle projects.
88
99- Shared management command: ` wait_for_resources `
1010 — Wait for database, Redis, Minio (S3) resources to be available before startup
11+ - Create Initial Users: ` create_initial_users `
12+ - Create Users with specified roles and permissions, useful to populate the database with default users during development or testing
1113
1214---
1315
1416## Installation
1517
1618** Using [ uv] ( https://github.com/astral-sh/uv ) :**
1719``` bash
18- uv pip install " git+ssh ://git@ github.com/toggle-corp/toggle-django- utils.git@main "
20+ uv pip install " git+https ://github.com/toggle-corp/banjo- utils.git@v0.1.0 "
1921```
2022
2123Or add to your ` pyproject.toml ` :
2224``` toml
2325[project ]
2426dependencies = [
25- " toggle-django -utils" ,
27+ " banjo -utils" ,
2628]
2729
2830[tool .uv .sources ]
29- toggle-django- utils = { git = " https://github.com/toggle-corp/toggle-django- utils" , branch = " main " }
31+ banjo- utils = { git = " https://github.com/toggle-corp/banjo- utils" , tag = " v0.1.0 " }
3032```
3133
3234---
3335
3436## Setup in Django
3537
36- 1 . ** Add to ` INSTALLED_APPS ` in your Django project's ` settings.py ` :**
38+ - ** Add to ` INSTALLED_APPS ` in your Django project's ` settings.py ` :**
3739
3840 ``` python
3941 INSTALLED_APPS = [
4042 # ... your other apps ...
41- " toggle_django_utils " ,
43+ " banjo_utils " ,
4244 ]
4345 ```
4446
45- 2 . (Optional) If your `settings.py` uses custom configs, ensure `" toggle_django_utils" ` remains in the app list .
46-
47-
4847-- -
4948
5049# # Usage
@@ -55,15 +54,32 @@ python manage.py wait_for_resources --db --redis
5554```
5655
5756** Command options:**
58- - ` --db ` & nbsp ;& nbsp ;& nbsp ;& nbsp ; Wait for database
59- - ` --redis ` & nbsp ; Wait for Redis server
60- - ` --minio ` & nbsp ; Wait for Minio (S3 storage)
61- - ` --timeout ` & nbsp ; Set max wait time (seconds)
57+ - ` --db ` : Wait for database
58+ - ` --redis ` : Wait for Redis server
59+ - ` --minio ` : Wait for Minio (S3 storage)
60+ - ` --timeout ` : Set max wait time (seconds)
6261
6362** Examples:**
6463``` bash
6564python manage.py wait_for_resources --db --redis
6665python manage.py wait_for_resources --timeout 300 --minio
66+ python manage.py create_initial_users --users-json="
67+ [
68+ {
69+ " username" : " admin" ,
70+ " email" : " test@example.com" ,
71+ " password" : " admin123" ,
72+ " is_superuser" : true,
73+ " is_staff" : true
74+ },
75+ {
76+ " username" : " user1" ,
77+ " email" : " user1@gmail.com" ,
78+ " password" : " user123" ,
79+ " is_superuser" : false,
80+ " is_staff" : false
81+ }
82+ ]'
6783` ` `
6884
6985---
@@ -83,6 +99,11 @@ python manage.py wait_for_resources --timeout 300 --minio
8399 ` ` ` bash
84100 uv run --all-groups --all-extras pytest
85101 ` ` `
102+ 4. Run commands for example project
103+ ` ` ` bash
104+ uv run --all-groups --all-extras python example/manage.py runserver
105+ uv run --all-groups --all-extras python example/manage.py wait_for_resources --db --redis
106+ ` ` `
86107
87108---
88109
0 commit comments