A batteries-included Django template for building modern web apps fast. Ships with:
- Django 5.2, Django Allauth, Django Cotton components
- PostgreSQL + Redis + Huey background tasks
- Tailwind CSS + HTMX + Alpine.js
- S3-ready storage backends
- Auto port detection (no conflicts with other projects)
- Railway deployment ready
uv run python -m project_setup \
--non-interactive \
--project-name myproject \
--start-docker-compose \
--run-migrationsThat's it. This command:
- Creates
.envfrom template - Finds free ports for Redis, PostgreSQL, and dev server
- Configures docker-compose with your project name
- Installs npm dependencies
- Starts Docker services
- Runs migrations
uv run python manage.py runserverThe dev server automatically uses the port configured during setup.
If you prefer prompts:
uv run python -m project_setupFor AI assistants bootstrapping projects:
uv run python -m project_setup \
--non-interactive \
--project-name myproject \
--check-docker-ports \
--update-project-name \
--create-env \
--configure-ports \
--configure-docker-compose \
--install-npm \
--start-docker-compose \
--run-migrationsAll flags documented in .kiro/steering/project-setup.md.
apps/ Your Django apps go here
onlydjango/
settings/
base.py Shared settings
dev.py Development (DEBUG=True)
prod.py Production
tests.py Fast SQLite test runner
constants/
dev.py Dev environment variables
prod.py Prod environment variables
templates/cotton/ Base components (layout, navbar, footer)
static/ Alpine, HTMX, Font Awesome
management/commands/ Custom commands
project_setup/ Project bootstrapping module
uv run python manage.py startapp myappApps are created in apps/ and auto-registered in settings.
Tests use SQLite for speed:
uv run python manage.py test --settings=onlydjango.settings.tests --noinputAll environment variables are centralized in onlydjango/settings/constants/. Never use os.environ directly elsewhere.
Key variables:
DJANGO_SECRET_KEY- Required for productionSITE_NAME- Used in templatesREDIS_URL- Redis connectionPGDATABASE,PGUSER,PGPASSWORD,PGHOST,PGPORT- PostgreSQLDEV_STORAGE- Set tolocalorS3for development
Generate Railway environment variables:
uv run python manage.py generate_railway_env \
--non-interactive \
--postgres-service myapp-db \
--redis-service myapp-cache \
--allowed-hosts myapp.up.railway.appThis generates Railway's ${{service.VARIABLE}} syntax for private network connections.
| Command | Description |
|---|---|
startapp |
Create app in apps/ with full scaffolding |
create_cotton_component |
Create a Cotton component |
validate_components |
Check Cotton component references |
model_schema |
Print model fields and methods |
generate_railway_env |
Generate Railway env vars |
runserver |
Dev server (auto-detects port from .env) |
Huey workers:
uv run python manage.py run_hueyIn development, tasks run synchronously when DEBUG=True.
uv run pyright # Type checking
uv run ruff check --fix # Linting
uv run python manage.py check # Django checks
npm run build:css # Build TailwindComponents use hyphens in tags, underscores in filenames:
<!-- Tag -->
<c-app.my-component />
<!-- File: apps/myapp/templates/cotton/my_component.html -->Base layout: onlydjango/templates/cotton/layout.html