Django 4.2 LTS Is Dead and 6.0 Is Security-Only: Django 5.2 LTS vs 6.1 in 2026

Two support windows closed on Django projects in 2026 and most teams noticed neither. Django 4.2 LTS, the version still powering a huge share of production deployments, stopped receiving security patches in April 2026. Then Django 6.0, released in December 2025, dropped out of mainstream support on August 4, 2026 — it now receives security fixes only, ahead of its end of life in April 2027.

That leaves exactly two defensible targets in November 2026: Django 5.2 LTS, supported until April 2028, and Django 6.1, the current feature release. They are not interchangeable, and picking the wrong one costs you either two years of runway or a Python upgrade you did not budget for.

TL;DR — pick in 20 seconds

  • Django 5.2 LTS if you run a production application on Python 3.10 or 3.11, need the longest possible support window, and want zero feature churn. Supported through April 30, 2028.
  • Django 6.1 if you are on Python 3.12+, want built-in Content Security Policy and the new Tasks framework without third-party packages, and can absorb a feature-release cadence.
  • Do not stay on Django 4.2. It has had no security releases since April 2026.
  • Do not target Django 6.0. It is security-only today and dies in April 2027 — the shortest runway of any option.

Support reality, verified against the official policy

ReleaseKindReleasedMainstream support endedEnd of lifePython versions
Django 4.2LTS2023-04-032023-12-042026-04-073.8 – 3.12
Django 5.2LTS2025-04-022025-12-032028-04-303.10 – 3.14 (from 5.2.8)
Django 6.0Feature2025-12-032026-08-042027-04-303.12 – 3.14
Django 6.1Feature2026-08-052027-04-302027-12-313.12 – 3.14

Read the fourth column carefully: a feature release gives you roughly 16 months from release to end of life. An LTS gives you three years. That difference — not the feature list — is what should drive the decision for anything customer-facing.

Decision matrix

Your constraintTargetReasoning
Production app, Python 3.10 or 3.11Django 5.2 LTS6.x requires Python 3.12+; 5.2 is the last line supporting 3.10/3.11
Production app already on Python 3.12+Django 6.1Full support until Dec 2027, plus CSP and Tasks built in
You need a 2028 planning horizonDjango 5.2 LTSOnly option with an April 2028 end of life
You ship an internal tool with a small teamDjango 5.2 LTSFewer moving parts, no feature-release churn
You need CSP without third-party middlewareDjango 6.1SECURE_CSP and ContentSecurityPolicyMiddleware ship in core
You still have 4.2 in production5.2 LTS now, 6.1 laterShortest path out of an unsupported release
Database is MariaDB 10.5Django 5.2 LTSDjango 6.0 dropped upstream MariaDB 10.5 support

What Django 6.x actually changes that matters

Django 6.0 is not a cosmetic release. Three changes affect how self-hosted deployments are built, and all three are reasons teams move — or reasons they wait.

Content Security Policy is now core

Before Django 6.0, CSP meant third-party middleware and hand-maintained headers. Now it is a setting plus a middleware:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# settings.py — Django 6.x
MIDDLEWARE = [
    "django.middleware.security.SecurityMiddleware",
    "django.middleware.csp.ContentSecurityPolicyMiddleware",
    # ... the rest of your middleware
]

SECURE_CSP = {
    "default-src": ["'self'"],
    "script-src": ["'self'"],
    "style-src": ["'self'", "'unsafe-inline'"],
    "img-src": ["'self'", "data:"],
    "object-src": ["'none'"],
    "base-uri": ["'self'"],
    "frame-ancestors": ["'none'"],
}

# Roll out safely: report violations before enforcing
SECURE_CSP_REPORT_ONLY = SECURE_CSP

Two operational notes that the release notes bury. First, the middleware only adds a header to responses that do not already have one — if a reverse proxy or a view sets Content-Security-Policy, yours is ignored, so audit your nginx or Traefik config before assuming it is live. Second, run report-only for at least a week on a real traffic profile. Inline scripts in admin templates and third-party widgets show up as violations the moment you enforce, and a broken admin is not a security win.

Background Tasks without Celery

Django 6.0 includes a Tasks framework: define a task, enqueue it, and let an external worker or service execute it. It is deliberately not a queue — Django ships backends but no worker process:

1
2
3
4
5
6
7
8
# myapp/tasks.py
from django.tasks import task

@task
def send_welcome_email(user_id: int) -> None:
    from myapp.models import User
    from myapp.mail import send_welcome
    send_welcome(User.objects.get(pk=user_id))
1
2
3
4
5
6
# settings.py
TASKS = {
    "default": {
        "BACKEND": "django.tasks.backends.immediate.ImmediateBackend",
    }
}
1
2
3
4
5
6
7
# anywhere in a view — note: enqueue, not delay
from myapp.tasks import send_welcome_email

def signup(request):
    user = create_user(request.POST)
    send_welcome_email.enqueue(user_id=user.pk)
    return redirect("dashboard")

The ImmediateBackend runs the task inline — perfect for development and tests, wrong for production. For production you configure a backend that hands work to your existing worker infrastructure, or you keep Celery and skip this entirely. The honest assessment: Django Tasks replaces Celery only if your needs are simple. If you depend on retries, routing, chords, or a monitoring UI, Celery with a broker is still the answer in 2026.

Template partials are built in

Django 6.0 absorbs the django-template-partials package into core. If your templates use {% partialdef %} and {% partial %}, the migration is a package removal plus template tag library changes — but check that no third-party app still imports the old tag library, because both installed at once produce confusing resolution errors.

Django 5.2 LTS — the safe harbor, and why it is not a dead end

Django 5.2 is not a compromise release. It is a full LTS with features that matter for real applications:

  • Composite primary keys. A first-class CompositePrimaryKey replaces the hacks teams used for join tables and legacy schemas.
  • Automatic models import in the shell. manage.py shell and shell_plus no longer need manual imports to poke at your models — small, but it saves minutes every single day.
  • Python 3.10 through 3.14 support as of 5.2.8, which means you can upgrade the interpreter independently of the framework.
  • Three years of security coverage, through April 2028.

For most self-hosted deployments — internal tools, admin panels, small SaaS products — 5.2 LTS is the correct answer in 2026. It buys you a stable target that will not require another migration until 2028, and by then Django 6.2 LTS will be the obvious destination.

The migration path, step by step

Step 1: upgrade the interpreter decision first

Django 6.x requires Python 3.12, 3.13, or 3.14. Django 5.2 supports 3.10 through 3.14. If your servers run Python 3.11 (still extremely common on Debian 12), you have two costs to compare: upgrading Python across your fleet, or staying on 5.2 LTS. Choose deliberately — not by accident when pip install fails.

1
2
3
# Pin the framework, keep the minor line explicit
python -m pip install "Django>=5.2,<5.3" --upgrade
python -m pip freeze | grep -i django

Step 2: surface deprecations before you switch

Django’s upgrade documentation is explicit about running tests with deprecation warnings turned on. Do this on the current version first — it tells you what will break before you break it:

1
2
3
4
5
# Python-level deprecations
python -Wd manage.py test --keepdb

# Django's own deprecation warnings, as errors
python -W error::DeprecationWarning manage.py check --deploy

Anything that raises here is a change you must make regardless of target version. Fix them on 4.2 or 5.2 first, ship that, then bump the framework — two small deploys beat one large one.

Step 3: audit the dependency tree, not just Django

The framework upgrade is easy. The ecosystem is where migrations die:

1
2
python -m pip list --outdated --format=columns
python -m pip install pip-audit && pip-audit

Check every package that touches Django internals: admin skins (django-jazzmin, django-admin-interface), REST layers (djangorestframework), auth (django-allauth), background jobs (celery, django-q2), and anything that subclasses Field, Model, or AdminSite. Those are the packages that break on a major bump.

Step 4: update the container image

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
FROM python:3.13-slim AS base
ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
RUN python manage.py collectstatic --noinput
USER 1000
CMD ["gunicorn", "config.wsgi:application", "--bind", "0.0.0.0:8000", "--workers", "3"]

Pin the interpreter major-minor in the base image (3.13-slim, not slim) and pin Django in requirements.txt with an explicit range. Both pins exist for the same reason: an unattended rebuild should never change two variables at once.

Step 5: verify in staging against a real database copy

Run the full test suite, then run manage.py check --deploy and manage.py migrate --plan against a restored production dump. Migration ordering problems and NULL-constraint surprises only appear with real data volume — the test database is too small to expose them.

Traps that turn a Django upgrade into an outage

Trap 1: silent settings changes. Defaults move between majors. USE_TZ has defaulted to True since 5.0, and any code still assuming naive datetimes will produce wrong timestamps rather than errors — the worst kind of bug. Grep for datetime.now() and timezone.now() usage and normalize before upgrading.

Trap 2: dropped database backends. Django 6.0 removed support for MariaDB 10.5. If your database is older than your framework, you are upgrading the wrong component first.

Trap 3: admin template overrides. Every Django release touches admin templates. Projects with copied templates/admin/*.html files silently lose new behaviour — CSP nonces and accessibility fixes among them. Diff your overrides against the installed version’s templates.

Trap 4: collectstatic in the wrong place. New static files in Django 6.x mean manifests change. If you serve static files from a CDN or an nginx alias, run collectstatic as part of the deploy and verify the hashed filenames resolve before flipping traffic.

Trap 5: trusting makemigrations output. A framework upgrade can change how model fields are serialized, producing migrations you did not intend. Always read the generated migration file before committing it; a spurious AlterField on a large table can lock it for minutes.

Which one should you actually run?

If you are on Django 4.2 today, the sequence is unambiguous: go to 5.2 LTS now, fix deprecations, ship, and revisit 6.x when your Python baseline moves to 3.12+. That path costs one migration and buys two years.

If you are already on Python 3.12+ and ship frequently, Django 6.1 is the better target: it is supported until December 2027, it removes the need for a CSP middleware dependency, and it collapses simple Celery use cases into core. Just be honest about whether your background processing is “simple” — most systems that think they are simple turn out to need retries and routing.

And if you are maintaining a Django app you only touch twice a year, the LTS is not a compromise. It is the correct engineering choice: fewer decisions, longer runway, same security posture.

For the wider Python stack around this migration, see our Python API framework comparison and the Python database migration tooling guide — schema changes usually land in the same sprint as a framework bump. If your upgrade also touches authentication flows, the Python authentication library comparison covers what breaks when session and token handling changes.

FAQ

Is Django 4.2 still safe to run in November 2026? No. Security support ended in April 2026, so vulnerabilities disclosed after that date are not fixed for 4.2. Running it means accepting unpatched risk in a framework that handles authentication, sessions, and form processing.

Should I upgrade to Django 6.0 or go straight to 6.1? Go to 6.1. Django 6.0 is already security-only and reaches end of life in April 2027, so adopting it means migrating again within months for no benefit.

How long should the Django 4.2 to 5.2 upgrade take? For a typical project with a working test suite, one to three days of engineering plus a staging soak. Dependency audits and admin template overrides dominate the effort, not the framework version bump itself.

Does Django 5.2 support Python 3.14? Yes, as of Django 5.2.8. Django 6.0 and later require Python 3.12 or newer, which is why 5.2 is the last option for projects still on 3.10 or 3.11.

Can Django Tasks replace Celery? Only for simple fire-and-forget work. Django provides task definitions, backends, and result storage, but no worker process — and no retry, routing, or workflow primitives. If you need those, keep Celery.

Do I need to change settings when moving to 6.1? Usually not, but audit timezone handling, static file storage, and any custom middleware ordering. New defaults and new middleware (CSP) change request/response behaviour even when your own code is untouched.


💰 想测试你的市场判断力?我用 Polymarket 做预测市场交易——这是全球最大的预测市场平台,从大选结果到技术监管时间线,什么都可以押注。和赌博不同,这是真正的信息市场:你懂的信息越多,胜率越高。我靠预测技术相关事件的走向已经赚了不少。用我的邀请链接注册:Polymarket.com