skills/backend/django/4.2/SKILL.md
Version-specific expert for Django 4.2 LTS. Covers psycopg 3 support, db_comment/db_table_comment, STORAGES setting, async streaming responses, async model methods, InMemoryStorage, and migration from 3.2 LTS. WHEN: "Django 4.2", "Django 4.2 LTS", "psycopg 3 Django", "psycopg3 Django", "db_comment", "db_table_comment", "STORAGES setting", "InMemoryStorage", "async streaming Django", "Django 4.2 migration", "Django 4 async".
npx skillsauth add chrishuffman5/domain-expert backend-django-4-2Install this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You are a specialist in Django 4.2 LTS, the long-term support release. As of April 2026, Django 4.2 has reached end-of-life (security support ended April 30, 2026). Migrate to Django 5.2 LTS now.
For foundational Django knowledge (ORM, views, middleware, admin, auth, DRF, settings), refer to the parent technology agent. This agent focuses on what is new or changed in 4.2.
| Detail | Value | |---|---| | Released | April 3, 2023 | | EOL | April 30, 2026 | | Python | 3.8, 3.9, 3.10, 3.11, 3.12 | | Status (Apr 2026) | End of life -- migrate to 5.2 LTS |
Django 4.2 adds support for psycopg version 3.1.8+ as a PostgreSQL adapter. The engine string does not change -- django.db.backends.postgresql works with both psycopg2 and psycopg3.
# pip install "psycopg[binary]>=3.1.8"
DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql",
"NAME": "mydb",
"USER": "myuser",
"PASSWORD": "mypassword",
"HOST": "localhost",
"PORT": "5432",
"OPTIONS": {
"server_side_binding": True, # psycopg3 only
},
}
}
Psycopg3 advantages over psycopg2:
Database-level documentation via db_comment and db_table_comment. Supported on all backends except SQLite.
class Order(models.Model):
customer_id = models.IntegerField(
db_comment="FK to customers table -- not enforced at DB level"
)
total = models.DecimalField(
max_digits=10, decimal_places=2,
db_comment="Order total in USD. Stored as decimal, not cents."
)
status = models.CharField(
max_length=20,
db_comment="Allowed values: pending, confirmed, shipped, cancelled"
)
class Meta:
db_table_comment = "Customer orders. Partitioned monthly in production."
Migration operation AlterModelTableComment changes table comments after creation.
The STORAGES dictionary replaces deprecated DEFAULT_FILE_STORAGE and STATICFILES_STORAGE settings (removed in 5.1).
# Old way (deprecated in 4.2, removed in 5.1):
DEFAULT_FILE_STORAGE = "myapp.storage.S3Storage"
STATICFILES_STORAGE = "django.contrib.staticfiles.storage.ManifestStaticFilesStorage"
# New way (Django 4.2+):
STORAGES = {
"default": {
"BACKEND": "myapp.storage.S3Storage",
"OPTIONS": {"bucket_name": "my-media-bucket"},
},
"staticfiles": {
"BACKEND": "django.contrib.staticfiles.storage.ManifestStaticFilesStorage",
},
"private": {
"BACKEND": "myapp.storage.PrivateS3Storage",
},
}
New InMemoryStorage class for tests -- avoids disk I/O entirely:
from django.core.files.storage import InMemoryStorage
storage = InMemoryStorage()
StreamingHttpResponse now accepts async iterators when served via ASGI:
import asyncio
from django.http import StreamingHttpResponse
async def stream_data(request):
async def generate():
for i in range(100):
yield f"data: chunk {i}\n\n"
await asyncio.sleep(0.1)
return StreamingHttpResponse(
generate(),
content_type="text/event-stream",
)
Model instance methods gained async equivalents in 4.2:
article = await Article.objects.aget(pk=1)
await article.asave()
await article.adelete()
await article.arefresh_from_db()
# Related manager async methods:
await author.articles.aadd(article)
await author.articles.aclear()
await author.articles.aremove(article)
await author.articles.aset([article1, article2])
makemigrations --update merges changes into the most recent migrationKT() expression for JSONField key transformsheaders parameter: client.get("/", headers={"accept": "application/json"})These were removed in Django 5.1. Fix before upgrading:
| Deprecated | Replacement |
|---|---|
| DEFAULT_FILE_STORAGE | STORAGES["default"] |
| STATICFILES_STORAGE | STORAGES["staticfiles"] |
| Meta.index_together | Meta.indexes |
| CICharField, CIEmailField, CITextField | CharField with db_collation="case_insensitive" |
| SHA1/MD5 password hashers | PBKDF2, Argon2, or bcrypt |
| length_is template filter | length filter with {% if %} |
| BaseUserManager.make_random_password() | secrets.token_urlsafe() |
The recommended enterprise path skips 5.0 and 5.1 (both EOL) and moves directly from 4.2 LTS to 5.2 LTS.
# Step 1: Fix all deprecation warnings
python -Wall manage.py test
# Step 2: Update STORAGES, Meta.indexes, etc. (see deprecation table above)
# Step 3: Ensure Python 3.10+ (5.2 requires 3.10-3.14)
# Step 4: Upgrade Django
pip install "django>=5.2,<6.0"
# Step 5: Run migrations check and full test suite
python manage.py migrate --check
python -W error::DeprecationWarning -m pytest
See 5.2/SKILL.md for full 5.2 feature coverage.
tools
kubectl command-line usage and scripting: kubeconfig and context management, output formats (jsonpath, custom-columns, go-template), all major verbs (get, describe, apply, delete, exec, logs, port-forward, rollout, scale, drain), workload resources, config/storage, networking, RBAC, node management, debugging (CrashLoopBackOff, ImagePullBackOff, OOMKilled), and scripting patterns (dry-run, diff, wait, jq, kustomize). WHEN: "kubectl", "k8s CLI", "kubeconfig", "namespace", "pod", "deployment", "service", "ingress", "configmap", "secret", "rollout", "scale", "drain", "taint", "kustomize". Do NOT use for cluster architecture, sizing, upgrades, or workload design decisions — that's the `kubernetes` skill in the `containers` plugin. This skill is command syntax and scripting kubectl against an existing cluster, not cluster ops.
tools
Bash 5.x shell scripting, Unix text processing, and command-line automation: variables, parameter expansion, quoting, control flow, functions, I/O redirection, error handling (set -euo pipefail, trap), and the Unix tool ecosystem (grep, sed, awk, jq, find, sort, uniq, cut, xargs). Covers process management, networking (curl, ssh, rsync, nc), file locking (flock), parallel execution, and production script patterns. WHEN: "Bash", "bash", "shell", "sh", ".sh", "shell script", "sed", "awk", "grep", "jq", "find", "xargs", "curl", "ssh", "rsync", "cron", "pipe", "redirect", "here-doc", "shebang", "POSIX", "set -euo pipefail", "trap".
tools
Azure CLI (az) command syntax and scripting: authentication (interactive, service principal, managed identity, SSO), output formats and JMESPath queries, resource groups, VMs, storage accounts/blobs, networking (VNets, NSGs, load balancers, DNS), Entra ID, AKS, App Service, Functions, databases (SQL, Cosmos DB, MySQL, PostgreSQL), Key Vault, Monitor/alerting, and infrastructure scripting patterns. WHEN: "az ", "Azure CLI", "az login", "az vm", "az aks", "az storage", "az keyvault", "az monitor", "az ad", "az group", "az network", "az webapp", "az functionapp", "az sql", "az cosmosdb", "JMESPath", "az account". Do NOT use for Azure architecture, landing zones, or multi-subscription strategy — that's the `cloud-platforms` plugin. This skill is about command syntax and scripting the CLI, not deciding what to provision.
tools
AWS CLI v2 command syntax and scripting: authentication (profiles, SSO, assume-role, instance profiles), output formats and JMESPath queries, pagination and waiters, IAM, S3, Lambda, RDS, CloudFormation, ECS, EKS, CloudWatch, SSM, Route 53, STS, and VPC networking. WHEN: "aws ", "AWS CLI", "aws ec2", "aws s3", "aws lambda", "aws iam", "aws cloudformation", "aws ssm", "aws ecs", "aws eks", "aws rds", "aws cloudwatch", "aws route53", "aws sts". Do NOT use for AWS architecture, service selection, multi-account strategy, or FinOps — that's the `cloud-platforms` plugin. This skill is about command syntax and scripting the CLI, not deciding what to provision.