django-backend-template-logo Backend Starter Template

Python 3.11 Django Checked with mypy pre-commit Code style: black Imports: isort

QuickStart

  1. create django-project

    pip install django
    django-admin startproject --template=https://github.com/KimSoungRyoul/django-backend-starter-template/archive/main.zip  hello_django_project
  2. create virtualenv(venv) using poetry & install library

    poetry config virtualenvs.in-project true # if true .venv was created in PROJECT ROOT
    poetry shell
    poetry install
  3. [Optional] install pre-commit config

    • if you want always run black&isort before commit
    pre-commit install
    • pre-commit run (reformatting)
    pre-commit run --files apps/**/**
  4. [Optional] if you want to use not only sqlite3

    docker compose -f docker/compose.yaml up -d
  5. django migration

    python apps/manage.py migrate
  6. create superuser for test

    python apps/manage.py createsuperuser --username=root --email=kimsoungryoul@gmail.com
  7. django runserver

    python apps/manage.py runserver 8000
  8. you can see default API Docs in http://localhost:8000/docs

    8-1. get JWT Token with Login API

    8-2. set JWT Token to API Docs

    8-3. you can use other APIs

build

  1. docker build
    docker build -f docker/application.dockerfile -t django-backend-starter-application:1.0.0 .
  2. docker run
    docker run -d -p "8000:8000" --rm --name django-backend-application django-backend-starter-application:1.0.0