Skip to content
Nat Lee

Keyboard shortcuts

Turn these off if they get in the way of a screen reader or voice control. The setting is saved in this browser.

1
Home
2
Work
3
Projects
4
About
5
Experience
/
Search projects
?
Show this panel

Web Development

Django Project Template

Full-Featured Django Template

A Django starter with PostgreSQL, Redis, JWT, social login, Channels and django-q2. The setup I kept repeating, now tested end to end.

Role
Creator & Maintainer
Period
2021 – 2026.11
Status
Completed
Categories
Infrastructure & backend
Stack
  • Python
  • Django
  • PostgreSQL
  • Redis
  • Channels
  • django-q2
  • Docker
Django Project Template, screenshot 1

Overview

A Docker Compose backend template with Django, PostgreSQL and Redis. It combines JWT and Google/Microsoft login, Channels WebSockets and django-q2 background tasks, configured from environment variables and checked end to end in CI.

What it's good for

Starting a new backend becomes copy, edit one .env, docker compose up; even the rename is a single variable, since the Python package is called backend on purpose. It also hands a coding assistant a tested codebase to copy from and one command to check its own changes.

How it fits together

Simplified on purpose. The real thing has more arrows and at least one config file nobody understands.

Keep localhost in ALLOWED_HOSTS. The container's health check lives there.

  1. Your frontend
    • browser
    → HOST_PORT
  2. NGINX
    • / → static files
    • /api, /ws → Django
    → proxies
  3. Behind NGINX

    Static files
    • frontend/ build
    This oneDjango backend
    • REST, JWT, allauth
    • Channels websockets
    • django-q2 worker
    → stores in
  4. Data services

    PostgreSQL 18
    Redis 8

Point at a box to see what it connects to.

The login playground: session, JWT and social login side by side, only while DEBUG is on.
The login playground: session, JWT and social login side by side, only while DEBUG is on.

Features

  • JWT with Google and Microsoft login
  • Channels WebSockets and django-q2 tasks
  • PostgreSQL and Redis in Docker Compose
  • Environment-based settings and end-to-end CI
WebSocket ping-pong through Channels, and a django-q2 task that answers pong.
WebSocket ping-pong through Channels, and a django-q2 task that answers pong.

Results

  • Reusable backend template with an end-to-end verification workflow

What I learned

  • A plain GitHub template plus .env beat startproject --template and cookiecutter: a template full of {{ project_name }} can't run, so it can't be tested as-is.
  • ALLOWED_HOSTS has to keep localhost, because the container health check needs it.
  • check --deploy passes with DEBUG=false but still nags about HSTS and HTTPS redirects, which only make sense once TLS sits in front of NGINX.
  • Infrastructure & backend1313 stars on GitHub

    Telepy

    One outbound reverse SSH tunnel per device gives you a browser terminal, files, remote desktop, a remote browser and the LAN behind it. No port forwarding, no VPN, no public IP.

    2024Active
  • Infrastructure & backend66 stars on GitHub

    Dev Dock Manager (Rust)

    One Docker dev box per user, with a web terminal, a noVNC desktop and optional GPU. The Django version, rewritten in Rust, partly to find out whether I could.

    2023Active
  • Spin-off · Contract work
    Infrastructure & backend11 stars on GitHub

    Blockchain from Scratch

    Nine hands-on chapters, from hashing to a peer-to-peer network. The same Rust code powers interactive WebAssembly demonstrations in your browser.

    2018Completed