Skip to content

A Django REST API template for scalable applications, featuring modern CI/CD, Docker Swarm deployments with zero-downtime SSL, automated changelogs, dynamic OpenAPI/Swagger UI documentation, and integrated tests with coverage reports, artifacts, and badges.

License

Notifications You must be signed in to change notification settings

aidoskanapyanov/django-rest-api-ci-cd-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

90 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Airplane Fuel Tracker REST API with Django

Django REST API CI CD Template

A Django REST API template for scalable applications, featuring modern CI/CD, Docker Swarm deployments with zero-downtime SSL, automated changelogs, dynamic OpenAPI/Swagger UI documentation, and integrated tests with coverage reports, artifacts, and badges.

Built with Cookiecutter Django Ruff coverage badge release badge license badge

buymeacoffee-white-badge

πŸ“š Documentation

For detailed information about the project, please check:

πŸ› οΈ Tech Stack

Backend Framework & API

  • Django: Python web framework for rapid development
  • Django REST Framework: Powerful toolkit for building Web APIs
  • DRF-Spectacular: OpenAPI/Swagger documentation generator

Testing & Quality Assurance

  • pytest: Feature-rich testing framework
  • pytest-django: Django-specific testing utilities
  • Coverage.py: Code coverage measurement
  • pre-commit: Git hooks framework for code quality checks

Security & SSL

  • Traefik: Modern reverse proxy and load balancer
  • Let's Encrypt: Automatic SSL certificate provisioning
    • ACME protocol for automated certificate issuance and renewal
    • Zero-downtime certificate rotation

Code Quality & Formatting

  • Black: Uncompromising Python code formatter
  • Ruff: Extremely fast Python linter
  • mypy: Static type checker

Development & Deployment

  • Docker: Container platform
  • Docker Compose: Multi-container development environments
  • Docker Swarm: Container orchestration for production
    • Zero-downtime deployments with rolling updates
    • Automatic service rollbacks on failure
    • Health checks and self-healing capabilities
  • GitHub Actions: CI/CD automation
  • Neovim: Blazingly fast, extensible code editor

Database

  • PostgreSQL: Robust relational database

πŸƒ Running Locally

Without Docker

Prerequisites

# Start PostgreSQL database
docker run -d \
    --name some-postgres \
    -e POSTGRES_PASSWORD=postgres \
    --rm \
    -p 5432:5432 \
    docker.io/postgres:16

Setup and Run

# Install dependencies
python -m pip install -r requirements/local.txt

# Setup database
python manage.py migrate

# Collect static files
python manage.py collectstatic

# Run server, and open http://localhost:8000/api/docs
python manage.py runserver

Development Commands

# Run tests
pytest

# Type checking
mypy fuel_tracker

# Test coverage
coverage run -m pytest
coverage html

πŸ‹ With Docker

Setup and Run

# Build the stack
docker compose -f docker-compose.local.yml build

# Start services
docker compose -f docker-compose.local.yml up

# Setup database
docker compose -f docker-compose.local.yml run --rm django python manage.py migrate

Development Commands

# Run tests
docker compose -f docker-compose.local.yml run --rm django pytest

# Type checking
docker compose -f docker-compose.local.yml run --rm django mypy

# Test coverage
docker compose -f docker-compose.local.yml run --rm django coverage run -m pytest
docker compose -f docker-compose.local.yml run --rm django coverage html
open htmlcov/index.html

β˜• Author

βš–οΈ License

This project is licensed under the MIT License.

About

A Django REST API template for scalable applications, featuring modern CI/CD, Docker Swarm deployments with zero-downtime SSL, automated changelogs, dynamic OpenAPI/Swagger UI documentation, and integrated tests with coverage reports, artifacts, and badges.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •