A production-ready, secure, and modern Django project template.
- Modern Tooling: Managed by
uvfor lightning-fast dependency resolution. - Dockerized: Multi-stage
Dockerfileandcompose.ymlfor local development. - Strict Config:
django-split-settingsandenvironsfor robust configuration. - Authentication:
django-allauthpre-configured with a custom User model. - Testing:
pytestfor unit tests.playwrightfor end-to-end tests with Aria Snapshots for ensuring structural integrity.
- Monitoring:
sentry-sdkintegration ready to go. - Best Practices:
- root-level
apps/andconfig/. rufffor linting and formatting.- Security hardening in production settings.
- root-level
- Docker & Docker Compose
- mise (for managing environment and tasks)
-
Install Dependencies:
mise run install
This will create a
.venvand sync dependencies usinguv. -
Run Server:
mise run serve
This runs the Django dev server along with the Tailwind CLI in watch mode.
-
Run Tests:
mise run testRuns both unit tests and Playwright E2E tests.
- Build and Start:
The app will be available at http://localhost:8000.
mise run docker-up
apps/: Django applications.core/: Core functionality and shared utilities.pages/: Static pages (Landing page, etc.).users/: Custom user model and auth logic.
config/: Configuration root.settings/: Split settings (base.py,development.py,production.py,components/).
e2e/: End-to-End tests using Playwright.tests/: Unit and integration tests.docker-compose.yml: Local services (Postgres, Redis).pyproject.toml: Dependencies and tool config.mise.toml: Task runner configuration.
We use Playwright's to_match_aria_snapshot() for E2E tests. This ensures the accessibility tree (structure) of pages remains consistent without being brittle to minor styling changes.
Configuration is split into base.py, development.py, and production.py.
Environment variables are handled via environs.
DATABASE_URL: Connection string for PostgreSQL.SENTRY_DSN: Sentry Data Source Name for error tracking.DJANGO_ENV:developmentorproduction.
See .env.example for a full list (make sure to create .env from it).
To use this for a new project:
- Clone/Use Template.
- Rename Project:
- Update
nameinpyproject.toml. - Search and replace
django-starter-template(if used in any specific config) with your project name.
- Update
- Reset Git:
rm -rg .git git init
- Install & Run: Follow the "Getting Started" guide.