Skip to content

FINWAX/django-microservice-base

Repository files navigation

Django Microservice Base

About

This project is base of microservice implements on Django.

Usage

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

Install

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"

Update

Use update script

sh ./update.sh -u1000 -g1000 -r"FINWAX/django-microservice-base" -d"/current-path" -p"/path-to-move-current-version"

Control

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

View

Check example endpoints:

  • http://127.0.0.1:8088/health/check - service works normal
  • http://127.0.0.1:8088/health/availability - service is available
  • http://127.0.0.1:8088/greeting/hello-protected - auth via Zitadel
  • http://127.0.0.1:8088/greeting/hello-unprotected?name=Nohj - GET params passed well

Links

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors