-
Notifications
You must be signed in to change notification settings - Fork 0
Django Architecture
The Django stack uses framework-driven object-oriented patterns: settings modules configure installed applications and middleware; DRF views/serializers handle HTTP; models and service functions/classes own domain and persistence work; optional Celery processes execute asynchronous work.
manage.py
pyproject.toml
config/
asgi.py
urls.py
settings/{base,development,production,test}.py
core/
apps.py
urls.py
views.py
middleware.py
errors.py
...selected capability modules
tests/
Dockerfile
docker-compose.yml
k8s/ # when selected
infra/terraform/ # when selected
config.asgi is the production application entry point, typically served by Uvicorn. manage.py owns administration and migrations. config.urls delegates API/health routes to generated applications. Celery worker/beat entry points appear only when the resolved capabilities require them.
flowchart LR
Client --> ASGI
ASGI --> Middleware
Middleware --> DRF[DRF view]
DRF --> Auth[authentication/permission]
Auth --> Service[domain service]
Service --> ORM[Django ORM]
ORM --> PostgreSQL
Service --> Response
Middleware establishes request context, logging, telemetry, and selected cross-cutting behavior. Authentication creates a principal; permissions/policies evaluate access; the view validates transport input and delegates domain work. Django transaction semantics commit or roll back ORM work.
Settings and Django's application registry provide framework wiring. Praxis capability manifests patch installed apps, middleware, URL configuration, and environment settings, then overlay capability-specific modules. Background/scheduled/email work uses Celery with Redis; this dependency is encoded in resolved capability closure and Compose/Kubernetes services.
Container startup applies framework checks/migration policy before serving as defined by generated scripts. Liveness indicates process health; readiness includes database and selected dependency reachability. ASGI servers drain requests on termination; Celery workers receive their own termination lifecycle. Kubernetes and Compose declare service-specific probes/dependencies rather than treating one process as the entire system.
JWT and fine-grained authorization integrate with DRF authentication/permission boundaries. Redis supports cache, realtime, and Celery prerequisites. Object storage, search, Kafka, flags, telemetry, logging, compliance, and operational capabilities add focused configuration/modules. Requested capabilities are not used directly at runtime; generated code reflects the verified resolved set.
Compose runs API, PostgreSQL, and only the workers/services required by resolved capabilities. Kubernetes emits separate Deployments/Jobs and configuration for API, worker, scheduler, migrations, and dependencies. Terraform provisions selected cloud foundations/managed services but does not run Django migrations or deploy application manifests by itself.
Create bounded Django applications or focused core modules, keep views transport-oriented, keep domain policy outside settings, use migrations for schema changes, and preserve environment separation. Template changes must patch named anchors and update stack/runtime/Compose/Kubernetes contracts together when a capability crosses those layers.
- Stack:
cli/templates/pro.django/ - Core:
cli/templates/pro.core/ - Capabilities:
cli/templates/pro.capability.jwt-auth/,pro.capability.background-jobs/ - Runtime contracts:
cli/tests/generator/proRuntime.test.ts - Capability contracts:
cli/tests/generator/proCapabilities.test.ts
This Wiki is generated from the repository's versioned docs/ source. Update and review the source files; do not rely on hand edits to generated Wiki pages.
- Core-Internals
- Architecture
- Repository-Map
- Code-Architecture
- Generation-Pipeline
- Manifest-System
- UI-Templates
- Testing
- Agent-Guide
- Wiki-Publishing
- Template-Architecture
- Standard-Projects
- Standard-Frontend-Architecture
- Express-Architecture
- Fullstack-Architecture
- Praxis-Pro
- Django-Architecture
- Gin-Architecture
- Capability-Architecture
- Compose-Architecture
- Kubernetes-Architecture
- Terraform-Architecture
- Extending-Generated-Projects
- Generated-Backends