django
Use when working with Django views, URL routing, templates, middleware, signals, admin, management commands, or settings configuration. Also use when adding async support to Django views, debugging N+1 queries, or setting up pytest-django for testing.
| Model | Source |
|---|---|
| sonnet | pack: python |
Full Reference
django
Section titled “django”Django 5.x is a batteries-included Python web framework. It owns the full stack: ORM, views, templates, URL routing, admin, auth, and middleware. Django 5.0 introduced GeneratedField and field-level facets; 5.1 added async auth backends; 5.2 added async user model methods and method_decorator support for async view methods.
Quick Reference
Section titled “Quick Reference”| Item | Value |
|---|---|
| Django version | 5.2 |
| Dev server | python manage.py runserver |
| Create migrations | python manage.py makemigrations |
| Run migrations | python manage.py migrate |
| Run tests | pytest (pytest-django) or python manage.py test <app> |
| Check prod config | python manage.py check --deploy |
| Settings pattern | Split: base.py / local.py / production.py |
Reference Index
Section titled “Reference Index”| I want to… | File |
|---|---|
| Structure a Django project and configure split settings | reference/project-structure.md |
| Write function-based and class-based views (including async) | reference/views.md |
| Configure URL routing and namespacing | reference/url-routing.md |
| Write custom middleware (sync and async compatible) | reference/middleware.md |
| Use signals and connect them safely via AppConfig.ready() | reference/signals.md |
| Write custom management commands | reference/management-commands.md |
| Customize the Django admin (list_display, actions, fieldsets) | reference/admin.md |
| Test Django views and models with pytest-django | reference/testing.md |
Usage: Read the reference file matching your current task from the index above. Each file is self-contained with code examples and inline gotchas.
Announcement
Section titled “Announcement”┏━ 🐍 django ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ Full-stack Python web framework — views, routing, admin, and more ┃ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛