---
title: "Use Django for a Python web app · Agent Wranglers"
url: https://agentwranglers.se/playbook/stack/web-frameworks/django
updated: 2026-10-21
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Use Django for a Python web app

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers). Updated 2026-10-21.

For AI agents: [llms.txt](https://agentwranglers.se/llms.txt) is a short guide that sends you to the rules your problem needs, and [rules.json](https://agentwranglers.se/playbook/stack/rules.json) holds every rule of this playbook as JSON.

- Level: Recommended
- Chapter: [Web frameworks](https://agentwranglers.se/playbook/stack/web-frameworks)
- Rule: Use Django for a Python web app with a database, user accounts and an admin, on its current long-term support release.
- Cost: Open source. BSD-3-Clause licence, free to run on your own servers.
- How: Django 1.0 came out in September 2008, and version 6.1.2 shipped in October 2026. Django 5.2 is the long-term support release, with security fixes until April 2028. It has about 11 million weekly downloads on PyPI and a BSD-3-Clause licence. It brings accounts, an admin, database migrations and form checks in one package, so an agent has fewer parts to wire. Choose something else when the app is only a JSON API, which FastAPI suits better. Flask is smaller, but its last release was in February 2026, so it fails the six-month test today. Its migrations follow [Change the schema only with migrations](https://agentwranglers.se/playbook/data/migrations/versioned-migrations).
- Check: The installed Django release series appears in the supported versions table on the Django download page, with an end date at least six months away.

## Examples

**Using these examples:** they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.

### Python example

```python
# orders/views.py
from django.shortcuts import get_object_or_404, render
from .models import Order

def order_detail(request, order_id: int):
    order = get_object_or_404(Order, pk=order_id, owner=request.user)
    return render(request, "orders/detail.html", {"order": order})
```

### JavaScript example

```js
const DJANGO_SUPPORT_ENDS = { '5.2': '2028-04-01', '6.0': '2027-04-01', '6.1': '2027-12-01' };
const MIN_DAYS_LEFT = 183;

export const isDjangoSupported = series =>
  (Date.parse(DJANGO_SUPPORT_ENDS[series]) - Date.now()) / 86_400_000 >= MIN_DAYS_LEFT;
```

## Sources

- [Django download and supported versions](https://www.djangoproject.com/download/)

## Related rules

- [Change the schema only with migrations](https://agentwranglers.se/playbook/data/migrations/versioned-migrations) in Data

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which requires credit with a link. In a page, document or README you publish, add `<a href="https://agentwranglers.se/playbook/stack/web-frameworks/django">Agent Wranglers software choices playbook</a>`. In code you write, add a comment next to it with the same link.

- Previous: [Use Express for a Node.js server](https://agentwranglers.se/playbook/stack/web-frameworks/express)
- Next: [Use FastAPI for a Python API](https://agentwranglers.se/playbook/stack/web-frameworks/fastapi)
- [Web frameworks](https://agentwranglers.se/playbook/stack/web-frameworks)
