Skip to content

laaraujo/django-api-template

Repository files navigation

tests codecov License: MIT

Django API Template

Opinionated template repo to kickstart Back-end/API projects with Django Rest Framework.

Features

Local setup

git clone [email protected]:laaraujo/django-api-template.git # clone this repo
cd django-api-template # cd into repository directory
python -m venv .venv # create virtual environment
source .venv/bin/activate # activate virtual environment
pip install -r requirements.txt # install dependencies
pre-commit install # initialize pre-commit hooks
cp .env.example .env # create .env file
make build # build containers
make run # run your containers locally

Make commands

build .................... : Build local containers
run ...................... : Run local containers
stop ..................... : Stop local containers
down ..................... : Stop and delete local container
makemigrations ........... : Django makemigrations command
migrate .................. : Django migrate command
createsuperuser .......... : Django createsuperuser command
shell .................... : Django shell command
sh ....................... : SSH into local API container
linter ................... : Run Ruff linter against all files in this repo

Documentation

Swagger docs are available in the /docs/ endpoint (http://localhost:8000/docs/).

⚠️ You'll get a 403 Forbidden response by default unless you are already logged in with an admin account (http://localhost:8000/admin/). If you want to change this behaviour you can modify the required permissions in ./src/app/urls.py