This project is base of microservice implements on Django.
Get script
git clone --no-checkout --depth 1 https://github.com/FINWAX/django-microservice-base.git temp && cd temp && git sparse-checkout init --cone && git sparse-checkout set scripts && git checkout master && cd .. && mv temp/scripts . && (rm -rf temp 2>/dev/null || Remove-Item -Path temp -Recurse -Force 2>$null)
Note: run scripts from the corresponding directory!
cd /path_to/scripts
Download project
sh ./install.sh -u1000 -g1000 -r"FINWAX/django-microservice-base" -d"/destination-path" -p"/previous-path-if-needs-import-data"
Prepare config in env.dev and prod.dev.
Then do first launch
sh ./first-launch.sh "/path-to/project"
Fill and validate env files for dev/test and production.
Then use
sh ./dev-launch.sh "/path-to/project"
or
sh ./prod-launch.sh "/path-to/project"
Use update script
sh ./update.sh -u1000 -g1000 -r"FINWAX/django-microservice-base" -d"/current-path" -p"/path-to-move-current-version"
If it needs - use docker compose exec dj ...command.
Run dev server
python manage.py runserver 8088
Add migrations for defined models
python manage.py makemigrations
Provide existing migrations
python manage.py migrate
Rollback all migrations
poetry run python manage.py migrate app zero
Flush database
poetry run python manage.py flush
Collect static files
poetry run python manage.py collectstatic --noinput
Add superuser
poetry run python manage.py createsuperuser
Check example endpoints:
http://127.0.0.1:8088/health/check- service works normalhttp://127.0.0.1:8088/health/availability- service is availablehttp://127.0.0.1:8088/greeting/hello-protected- auth via Zitadelhttp://127.0.0.1:8088/greeting/hello-unprotected?name=Nohj- GET params passed well