Django
Comprehensive guide to Django covering security, ORM, PostgreSQL, GeoDjango, Django 6.0 essentials, admin extensions, and ecosystem tools.
Overview
Django provides a batteries-included web framework with robust features out of the box:
- Security - CSRF protection, authentication, sessions, password hashing, security middleware
- ORM - Powerful database abstraction with query optimization
- PostgreSQL - Full-text search, array fields, JSONB, range fields
- GeoDjango - Geographic database operations with GPS extraction
- Django 6.0 - Middleware changes, built-in tasks framework, CSP, GeneratedField
- Admin Extensions - Operational dashboards and monitoring tools
Specialized Skills
For deeper coverage of specific domains, see these dedicated skills:
- ↳ django-admin — Admin save_formset/get_search_results/db_index patterns
- ↳ django-transaction — atomic/select_for_update/on_commit/upserts
Deep Dives
Load these reference files on demand for detailed coverage:
- ↳ security.md — CSRF protection, sessions, security middleware, field-level encryption
- ↳ authentication-permissions.md — Authentication views, custom backends, password management, login templates, Django permissions
- ↳ orm-performance.md — ORM optimization, caching, response time, materialized views
- ↳ postgresql.md — pgvector, GeneratedField, GeoDjango, PostgreSQL features
- ↳ django6-modern.md — Django Tasks framework, 6.0 essentials, multi-DB routing, model fields, app naming
- ↳ testing-migrations.md — Testing optimization, migrations, signals, StreamingHttpResponse
- ↳ external-api.md — Operational dashboards, external API integration
- ↳ ecosystem.md — Django ecosystem libraries
Best Practices
- Always use {% csrf_token %} in POST forms
- Use HTTPS in production (SECURE_SSL_REDIRECT = True)
- Enable HSTS for secure connections
- Set secure cookies (SESSION_COOKIE_SECURE = True)
- Use strong password validation
- Use @login_required for protected views
- Never expose sensitive data in URLs or logs
- Validate file uploads carefully
- Use prepared statements (Django ORM does this automatically)
References
1---2name: django3description: Use when building Django applications - security hardening, authentication and permissions, ORM optimization, PostgreSQL features, Django 6.0, migrations, testing, and ecosystem libraries4metadata:5 source: https://skillmd.com/skills/mte90/django6 author: mte907 version: 3.0.08 tags:9 - python10 - django11 - security12 - orm13 - postgresql14 - admin15 - authentication16 - sessions17---1819# Django2021Comprehensive guide to Django covering security, ORM, PostgreSQL, GeoDjango, Django 6.0 essentials, admin extensions, and ecosystem tools.2223## Overview2425Django provides a batteries-included web framework with robust features out of the box:26- **Security** - CSRF protection, authentication, sessions, password hashing, security middleware27- **ORM** - Powerful database abstraction with query optimization28- **PostgreSQL** - Full-text search, array fields, JSONB, range fields29- **GeoDjango** - Geographic database operations with GPS extraction30- **Django 6.0** - Middleware changes, built-in tasks framework, CSP, GeneratedField31- **Admin Extensions** - Operational dashboards and monitoring tools3233## Specialized Skills3435For deeper coverage of specific domains, see these dedicated skills:3637- ↳ **[django-admin](frameworks/django-admin/SKILL.md)** — Admin save_formset/get_search_results/db_index patterns38- ↳ **[django-transaction](frameworks/django-transaction/SKILL.md)** — atomic/select_for_update/on_commit/upserts3940---4142## Deep Dives4344Load these reference files on demand for detailed coverage:4546- ↳ **[security.md](references/security.md)** — CSRF protection, sessions, security middleware, field-level encryption47- ↳ **[authentication-permissions.md](references/authentication-permissions.md)** — Authentication views, custom backends, password management, login templates, Django permissions48- ↳ **[orm-performance.md](references/orm-performance.md)** — ORM optimization, caching, response time, materialized views49- ↳ **[postgresql.md](references/postgresql.md)** — pgvector, GeneratedField, GeoDjango, PostgreSQL features50- ↳ **[django6-modern.md](references/django6-modern.md)** — Django Tasks framework, 6.0 essentials, multi-DB routing, model fields, app naming51- ↳ **[testing-migrations.md](references/testing-migrations.md)** — Testing optimization, migrations, signals, StreamingHttpResponse52- ↳ **[external-api.md](references/external-api.md)** — Operational dashboards, external API integration53- ↳ **[ecosystem.md](references/ecosystem.md)** — Django ecosystem libraries5455---5657## Best Practices58591. **Always use {% csrf_token %}** in POST forms602. **Use HTTPS** in production (SECURE_SSL_REDIRECT = True)613. **Enable HSTS** for secure connections624. **Set secure cookies** (SESSION_COOKIE_SECURE = True)635. **Use strong password validation**646. **Use @login_required** for protected views657. **Never expose sensitive data** in URLs or logs668. **Validate file uploads** carefully679. **Use prepared statements** (Django ORM does this automatically)6869---7071## References72