Rewriting Django's Async Story, a Visual Guide
TL;DR: For years Django's own documentation told people its async support was unfinished and slow. The topic guide has now been rewritten, because the async API covers the ORM, cache, authentication, sessions and signals, and the overhead of mixing sync and async code has shrunk from milliseconds to microseconds. What's still hard about async is shared by every Python framework. Meanwhile Django 6.0 added a Tasks framework, Django 6.1 brings fetch modes and database-level cascades, and free-threaded Python looks set to reward Django's long bet on threads.
"For years, Django and Async came with an asterisk." That's how Michael Kennedy, host of Talk Python, framed the topic. The docs themselves warned you off it, with scary performance notes and a story that felt half finished.
So is Django's async story ready or not? The framework now lets you write async def views, query the ORM with await, and use the cache, sessions, authentication and signals the same way. Carlton Gibson, a former Django Fellow who sits on the Django steering council, rewrote the topic guide to say so, and his answer is yes: the async API is complete.
That doesn't mean async is free. It's still an order of magnitude more complicated to get right than plain synchronous code, and the limits people keep hitting (the GIL, CPU-bound work, the size of the database connection pool) aren't Django problems at all. You'd meet the same ones in FastAPI or Flask.
The sections below take it in order: why the docs changed, what the async API covers and how it works underneath, where the real ceilings are, and how to run async code without letting it spread through your whole codebase. Then come the new features: Django Tasks for background work, fetch modes for the N+1 query problem, database-level cascades, and Django Mantle, a typed serialization project. Last comes deployment: when to switch from WSGI to ASGI, a hybrid setup that keeps the boring parts boring, and why free threading might be the biggest change of all.
Is Django async ready? Why the async docs were rewritten
Django's asynchronous support topic guide was written when async first landed in the framework, back in the Django 3.x era, and its tone was very negative. It said the work was unfinished and still in development, and that the performance implications were terrible unless you did everything perfectly.
That was a fair read at the time. In the Python 3.5 and 3.6 days, async and await had a kind of Python 2 to 3 problem. Even if you wanted to write async code, the library you needed to call, the one talking to the internet or the database, wasn't async. So what was the point?
Async has come an awful long way since then, and the guide hadn't kept up. Take the overhead warnings. Much of Django's async support runs synchronous code in a thread and awaits the result, a mechanism the next section explains. Setting up that hop used to cost on the order of milliseconds. On the latest Pythons, Carlton Gibson, who rewrote the guide, puts it at tens of microseconds. Against requests measured in milliseconds, that's rarely visible by itself, yet the page still said it was going to slow your requests down. The current guide keeps a more careful version of the point: the per-call cost of switching between call styles is small, but it can show up under GIL contention as the number of active threads grows, so the advice is to cross the boundary once rather than in a tight loop.
The performance warnings were "a bit overplayed in this latter day," so they became notes, and the claim that the story wasn't finished came out. The old guide was scaring people off something that works.
Does that make async in Django problem free? No. You will run into problems as you scale up, but they're problems with async in Python, not with Django, and the docs should say so instead of pinning them on the framework. Those shared limits get their own section: the GIL, CPU work and database connections.
“And that's why we made the effort to update the topic, because we realized we were giving users bad advice.”
Carlton Gibson
What Django's async API covers, and how sync_to_async works underneath
What does "complete" actually mean? The ORM, the cache framework, authentication, sessions and signals all have an async API now. From a user's perspective it really is all there: you can write an async view and await your way through a request without dropping back to synchronous calls for the everyday parts of Django.
The ORM shows the pattern. Methods that return a new queryset, such as filter(), don't touch the database, so they stay as they are. Every method that does run a query has an a-prefixed twin: get() becomes aget(), create() becomes acreate(), count() becomes acount(). Iteration uses async for. Here's a view that uses all of those plus the async cache API:
from django.contrib.auth.models import User
from django.core.cache import cache
from django.http import JsonResponse
async def user_summary(request, user_id: int):
user = await User.objects.aget(pk=user_id)
active = await User.objects.filter(is_active=True).acount()
names = [u.username async for u in User.objects.filter(is_active=True)]
await cache.aset(f'seen:{user_id}', True, timeout=60)
return JsonResponse({'user': user.username, 'active': active, 'names': names})
How Django gets there matters, because it explains both the old fears and the remaining limits. Much of the work relies on a helper from the asgiref library called sync_to_async. You wrap a synchronous function and get back something you can await, and the call runs in a thread. Python's own asyncio.to_thread does essentially the same job.
So why not use that? Because sync_to_async adds niceties Django needs, and the main one is thread tracking. By default it runs thread-sensitive code on the same thread every time, because database connections are tied to a thread, and so is the transaction state that lives on each connection. Queries have to run on the thread their connection belongs to, or there will be problems.
That thread hop is the overhead the old docs warned about, and on a modern Python it's rarely visible on its own. One related trap: a relation that hasn't been prefetched is loaded lazily with a blocking query, so touching it inside async code raises SynchronousOnlyOperation. Prefetch what you need first.
None of this means the work is done. Async in Django is an ongoing project, still being developed, fixed and extended. And the thread-bound connection has one lasting consequence for transactions, covered in the next section on the real limits of async.
“It doesn't mean there's no work to be done. It's an ongoing project. We keep developing it. We keep fixing new things. We keep adding new things.”
Carlton Gibson
The real limits of async Python: the GIL, CPU work and database connections
If Django's async API is complete, what's left? Three things, and none of them are specific to Django.
The database connection pool. Each database connection is an ordered pipe: it takes a query and gives back a response. Whether you drive it from threads, the way Django does, or from greenlets, the way some other ORMs do, you're limited by the size of your connection pool. That's true on WSGI and on ASGI, and it always has been. To scale up, you need a bigger pool or a more efficient way of using it.
Transactions. Django's connections are tied to a thread local, so Django isn't going to support calling await inside an atomic block. The code after an await may not run on the same thread as the connection, and the transaction state lives on that connection. That doesn't mean no transactions in async code. You wrap the whole transaction in a single function and call it through sync_to_async:
from asgiref.sync import sync_to_async
from django.contrib.auth.models import User
from django.db import transaction
@sync_to_async
def deactivate_user(user_id: int) -> None:
# One function, one thread, one connection: the whole transaction runs here.
with transaction.atomic():
user = User.objects.select_for_update().get(pk=user_id)
user.is_active = False
user.save(update_fields=['is_active'])
async def deactivate(request, user_id: int):
await deactivate_user(user_id)
...
Try transaction.atomic() directly inside an async function and Django stops you with a SynchronousOnlyOperation error.
CPU-bound work. An event loop is single threaded. It switches tasks at each await, but plain Python crunching numbers never yields. So CPU work either blocks the loop or goes to a thread, where it contends for the GIL. Sprinkling asyncio.sleep(0) into a CPU-heavy loop to hand control back is a symptom of the mismatch: the event loop was built for I/O, not for that. Either way you end up with about one thread's worth of CPU time. A separate process gets around that, but it's crazily heavy: you have to bootstrap the process and marshal the data back and forth. That's Python's real problem, and FastAPI or Flask would hit exactly the same one. It can bite at moderate scale, too, though a small blog at ten requests a minute won't notice.
Before you reach for any of this, check the boring thing first. If requests feel slow, take an hour to look at your database indexes and query plans, and make sure every hot path uses an index. Database indexes are magic. A Django query spends a little CPU compiling the SQL, then waits on I/O, then spends CPU turning rows into ORM objects. psycopg already releases the GIL during that I/O wait, so that concurrency is yours today, async or not.
“It was your database all along that was the thing that was taking the time.”
Carlton Gibson
Is async viral? Capping the function coloring problem in Django
A common reason for avoiding async is that it's viral. Say you have a low-level function that's async: the function that calls it has to be async, and so does the one above that, until it cascades through the rest of your app. Viral in the GPL sense. This is usually called the function coloring problem: once you have a red function or a blue one, every function that calls it has to be the same color.
Is that really a trap? It doesn't have to be. A synchronous function can call async_to_sync and stop the propagation right there. That helper from asgiref wraps an async function so sync code can call it, and the Django docs describe it as a more powerful asyncio.run(). It's meant for sync code: call it from a thread that already has a running event loop and you get a RuntimeError. Or you can create your own asyncio event loop and run just that one bit. The async part stays inside one function, and nothing above it changes color.
To make this concrete, here's a synchronous function that has to call five external endpoints. Called one after another, the waits add up. Fired concurrently, they overlap. Here's a plain sync Django view doing exactly that:
import asyncio
import httpx
from asgiref.sync import async_to_sync
from django.http import JsonResponse
URLS = [
'https://www.djangoproject.com/',
'https://www.python.org/',
'https://pypi.org/',
'https://docs.python.org/3/',
'https://talkpython.fm/',
]
async def fetch_all(urls: list[str]) -> list[int]:
async with httpx.AsyncClient(timeout=10) as client:
responses = await asyncio.gather(*(client.get(url) for url in urls))
return [r.status_code for r in responses]
def status_board(request):
# A plain sync view. The async code starts and stops on the next line.
statuses = async_to_sync(fetch_all)(URLS)
return JsonResponse({'statuses': statuses})
Calling several external services concurrently is one of the easiest ways into async with Django. Picture an ordinary WSGI app on Gunicorn with four workers, each a single-threaded process doing its thing. You want to make some API requests, so you define a single async view. Django's handlers run that view in an event loop for you, it fires off the five HTTP requests, aggregates the results and returns one response. The rest of the app never knows. The Django docs say the same: under WSGI an async view runs in its own one-off event loop, so concurrent async HTTP requests work without trouble, though you don't get the benefits of a full async stack.
The complexity stays fenced into a single view, and the win is clear.
“And that can just be done in a fraction of the time of calling one and then the other.”
Carlton Gibson
Django 6.0 Tasks: background jobs without standing up Celery
Async and background tasks sound related, and when async first arrived in Django a lot of people assumed it was about running jobs in the background. It isn't. Async is about I/O, many connections and long-lived requests. A task queue solves a different problem: getting slow work out of the request so the user doesn't wait. Django 6.0 added a built-in Tasks framework for that second problem.
The classic case is the password reset email. The old way takes the request, sends the email, waits for it to go out (which can take almost any amount of time), and only then returns the HTTP response. That's a bad experience. The better pattern accepts the request, quickly writes a task (to the database, say) and responds right away: it's on its way, give it a few seconds. A separate worker process picks up the task and sends the email.
People have built that with Celery, RQ, Django Q, Django Q2 or Huey for years, and there are a billion of these queues out there. So what's new? Django itself couldn't rely on any of them, and neither could a third-party package. A package author who picked Django Q2 would shut out everyone running Celery, RQ or Huey.
Django Tasks fixes that with one common API. A package enqueues a task and checks its result, and the site owner picks the backend in settings. Here's what that looks like:
# settings.py
TASKS = {
'default': {'BACKEND': 'django.tasks.backends.immediate.ImmediateBackend'},
}
# tasks.py
from django.tasks import task
@task
def send_reset_email(user_id):
...
# in a view
result = send_reset_email.enqueue(user_id=42)
print(result.status)
The two backends that ship with Django, immediate and dummy, are for development and testing. The immediate one runs the task on the spot, in the same process. The dummy one only records it. A real worker needs a backend from another package. As of mid-2026, backends existed for Redis and for the ORM (tasks stored in your own database), and a Celery adapter was reportedly an open issue.
Is Celery bad, then? Not at all, but it's built for a level of sophistication most apps don't need. Running it means a monitor, a beat server and the workers, and later a private network, poison messages and downtime when the Celery version has to change. Before adding it, look honestly at your ops capacity. Is someone on call when the workers break at two in the morning?
For most projects, start with the database backend. Redis works just as well if it's already in your stack. And don't hand background work to an asyncio executor instead: there are no queue controls, no result, no way to tell whether it failed or to retry it, and no clean recovery if it crashes.
“It really is a truly wonderful piece of software. But it's literally overkill for 99% of projects. And it's operationally difficult to keep going.”
Carlton Gibson
Django 6.1 fetch modes and the N+1 query problem
Lazy loading is Django's default for related objects: you touch book.author and Django runs a query right then. At small scale that's great. Loop over a list of books and show each author, though, and you get one query for the list plus one more per book. That's the N+1 query problem, and it's a performance nightmare that people hit again and again.
The usual fix is prefetch_related, added by hand wherever it's needed. That's fine the first time. The trouble is keeping it up to date: code changes, and soon you're prefetching something you no longer use. A data-access function that returns books ends up needing a flag for "and the authors", because some callers want them and some don't.
Django 6.1 adds fetch modes, set on the queryset. The interesting one is FETCH_PEERS, which works like a deferred prefetch_related. Objects loaded by the same queryset are peers. Touch a related object on the first one, and Django fetches it for all of them in a single query. Code that was going to lazy load anyway gets upgraded to one eager load at the moment it's needed:
from django.db.models import fetch_modes
for book in Book.objects.fetch_mode(fetch_modes.FETCH_PEERS):
print(book.author.name)
On a table of ten books, checked with Django 6.1.3, the default loop ran 11 queries. With FETCH_PEERS it ran 2. There's a third mode, FETCH_RAISE, which raises FieldFetchBlocked instead of fetching, so an accidental lazy load shows up as an error.
Is it a magic fix to switch on everywhere? No. A DjangoCon Europe talk covers how fetch modes work and where their limits are. In informal conversations, most people pointed to this one as the headline feature of 6.1.
A smaller 6.1 change comes from the same spirit: you can now customize the multipart parser class on the request object. Most people never will. But with big multipart requests and lots of parts, swapping in a different parser could save maybe 30% of the CPU spent parsing. The bigger point is the direction: it opens a path to swapping out more of the request implementation, comparing alternatives and turning knobs that used to be fixed. It's also a good reason to read the long release notes with every Django release and pick out your own favorites.
“If I access the first element in a list of related objects, go and get them all at once.”
Carlton Gibson
Database-level cascades in Django 6.1, and the sprint that shipped them
Say a user has bookmarks, and each bookmark has a foreign key back to the user. What happens to the bookmarks when you delete the user? Normally you cascade the delete, and Django has always offered that through on_delete.
The catch is how it did it. Historically, Django ran the cascade in memory, in Python. It walked the tree, pulled the objects in, deleted the leaves, then the stems, and finally the branches. That's fine for a user with a handful of bookmarks. Now picture an organization with team members and projects, or one record that references several tables with a million entries. Delete the organization and the application can run out of memory.
Django 6.1 adds the option to push the cascade down into the database. The database still has to do the work, but it's much better at it than Python is. You opt in per foreign key:
from django.db import models
class Book(models.Model):
author = models.ForeignKey('Author', on_delete=models.DB_CASCADE)
With DB_CASCADE, Django writes the foreign key as ON DELETE CASCADE in the table definition (checked on SQLite with Django 6.1.3), so the database removes the child rows itself. There was no way to get that from the Python side before. The only workaround was a custom database backend that changed how tables are created, which isn't sustainable.
Why did it take so long? The ticket had been open for years because it was hard. It finally got over the line at Django on the Med, a three-day core developer sprint where four contributors, including the new Django Fellow, worked on it together. The first one ran at the start of October 2025, and the next was set for Pescara, Italy, in September 2026. It's open to everybody, not just core developers, and the aim is to team experienced contributors up with new ones, since the learning curve is a big part of what makes contributing feel scary.
In-person time also unsticks things. Disagreements that had rolled on for months on Django's new features board settled in five minutes in a room. And the community took a real knock from COVID that has taken about half a decade, by one estimate, to recover from.
You can help without traveling. Install the beta of an upcoming release (Django 6.1 was in beta in July 2026) and run your test suite against it. If it passes, you're good. If it doesn't, the team wants to know before release day, not after. And take the Django Developer Survey: five minutes of your time really does help drive Django forward.
“The database is much much much better at doing that work than python is.”
Carlton Gibson
Django Mantle: typed serialization as static islands over a dynamic ORM
Serialization turns a database row into something you can send over the wire, and Django REST Framework has done that job wonderfully for a long time. But it's aging, and its serializers in particular are last generation. They go through the model, get each field object, get the value from it, and loop. Newer libraries work differently. attrs writes the boilerplate for ordinary Python classes, cattrs converts those classes to and from plain dictionaries while validating them, and msgspec and Pydantic play in the same space. The code they generate is almost as quick as if you'd written the attribute-by-attribute extraction by hand. Next to that, DRF's field-by-field looping is slower.
So why not just use Pydantic? It's fantastic, but it isn't ORM aware. It has no insight into how Django works.
Django Mantle is an attempt to fill that gap. It's a type-safe wrapper around Django's ORM. You write attrs classes that describe the shape you want, instantiate a query and fetch. You get back fully instantiated objects in that shape, nested objects included, with all the data fetched in one go, plus writes with validation. Because it's ORM aware, it selects only the fields it needs and does the prefetch_related calls for you, so it is designed to avoid the N+1 query problem. And since the results are attrs classes, your type checker knows its way around them.
Why not just add types to Django models? Because the real type of a model attribute is a deferred field: an object that uses the descriptor protocol to hand you the converted value when you access it. Typing that is awkward. Django's ORM is built on powerful dynamic patterns, and retrofitting static typing onto them would be a real problem. So Mantle leaves the dynamic layer alone and puts static islands on top. The shape classes are pure Python, with full type safety, no hidden mutation and none of the active-record habit of changing a property and saving.
That matters because of how apps grow. A Django model is an active record: a database row that's also an object with behavior. Over time its display logic, aggregation logic and validation logic pile up on that one class, and abstracting a method doesn't help if it never served a single responsibility. Everyone who's grown a Django app has seen it, and it's perfectly normal. Mantle is a path toward more structure once you need it, not a place to start. Starting there would be over-engineering.
Typing has a cultural side too. Carlton, for one, likes that Python fits your brain, and worries that typing can push code past that point. The PEP that introduced type hints said they wouldn't become compulsory, even by convention, yet there's real pressure to adopt them. AI adds a twist: models often write typed Python unprompted, and since the big issue with AI output is verifying it, any type safety a checker gives you helps.
“And so the mantles, the shape classes that you define, they're your static islands.”
Carlton Gibson
Free-threaded Python and Django's long bet on threads
The GIL, the global interpreter lock, lets only one thread run Python code at a time, even on a multi-core machine. Free-threaded builds of Python (PEP 703) make it optional. That's the backdrop for a design choice in Django that looked a little clumsy for years: when in doubt, it pushes synchronous work into a thread. With the GIL in place, those threads couldn't truly run Python in parallel, so what was the point?
Free threading changes the answer. As free-threaded Python becomes more established and works its way through the ecosystem, it looks as if Django's bet will have aged very well, because CPU work was always meant to go in a thread. Picture a thread pool where each thread keeps a database connection hanging around, ready to go: you delegate work out and get actual parallelism.
Who needs that? A Hello World blog with 10 requests a minute isn't going to hit GIL contention, even on a good day on Hacker News. But a serious application has to use the CPU at some point, otherwise it isn't doing anything. At scale the GIL has been the impediment, and a common reaction has been to switch to Rust or Go. Do we really want to switch language again?
You also don't need Instagram-level traffic to benefit. If parallelism lets you shrink the number of workers until two servers become one, that saves ops work and money.
What's left to do? Mostly the ecosystem, not the architecture, which is already in place. Threaded Django has been around a long time, with WSGI servers using threaded workers. At the app level, though, most code has never had to think about threads. A module-level cache or a property at module level is a good example: is it really thread safe, or does it need a lock? The bigger questions are in extensions and libraries. The work is to go through them, run the test suites and make sure they're compatible with free threading. Once that's done, it should open up a lot of performance for everybody: instead of running multiple processes to get parallelism, you run it all in one.
It's also easy to try now. It used to mean finding or building a special Python. With uv it's one command and a couple of seconds. To check that the GIL really is off:
uv python install 3.14t
uv run --python 3.14t python -c "import sys; print(sys._is_gil_enabled())"
That second line prints False on a free-threaded build.
“It looks as if Django's bet's going to pay off. That bet will have aged very well. Because we always really wanted to do CPU work in the thread.”
Carlton Gibson
WSGI or ASGI: when should a Django app switch?
A Django project ships two server entry points: wsgi.py for WSGI servers such as Gunicorn, and asgi.py for ASGI servers such as Granian or Uvicorn. So do you have to switch to an ASGI server the moment you write an async view? No. Async views run fine under WSGI. The better question is what moving to ASGI actually buys you, and the answer is long-lived requests.
Server-sent events are the classic case. The client holds a connection open and the server pushes an update down it every few seconds, like a stock ticker streaming the latest price. WebSockets and streaming responses are the same kind of thing.
On WSGI, each connection is a worker. Say you run four workers and three are held open by clients watching the ticker. Now one worker is left for every other request. Doubling the workers is the obvious fix, but pre-forked workers are separate processes, so every extra one is another copy of your Django application in RAM, another cache to prime and another set of database connections to open. An ASGI worker handles it differently. It holds the connection open and serves it from the event loop, so one worker can carry many connections at once.
Both entry points come from the same project, so trying the other one is a one-line change:
# WSGI: Gunicorn forks four worker processes
gunicorn mysite.wsgi --workers 4
# ASGI: Granian serves the same project through asgi.py
granian --interface asgi mysite.asgi:application
So there's a threshold. Polling, even once a second, won't really overload your WSGI workers. Holding connections open is where async and ASGI are called for.
This matters more as front-end tools lean on server-sent events. Datastar is built around them, and HTMX 4, in beta as of mid-2026, was inspired partly by Datastar. Template partials, added to Django, pair well with HTMX.
How do you introduce ASGI once you need it? Not necessarily all at once. That's the subject of the hybrid deployment section next.
“Well, you don't want to do that on the WSGI model because each connection is a worker on WSGI.”
Carlton Gibson
A hybrid WSGI and ASGI deployment, and the memory it saves
How do people actually run async Django? Two patterns work well.
Small projects run a single ASGI worker. A low-traffic app with a sprinkle of async, like a personal blog, is probably served fine by one ASGI worker on its own. There's no scaling problem to solve.
Larger apps keep WSGI and add an ASGI sidecar. The core application stays on WSGI, served the standard way, because the scaling patterns there are so established that they're almost trivial by comparison. Next to it runs a single ASGI process for the async endpoints. Nginx, a web server that can sit in front of both as a reverse proxy, routes by path: everything under an /a prefix goes to the sidecar and everything else goes to WSGI. Routing on something else, like the connection header, is possible but a little more advanced. The split also keeps CPU-bound work, which causes contention on the event loop, away from the async endpoints.
The two servers are just two commands on different ports, with the proxy deciding who gets what:
# The core app, on WSGI
gunicorn mysite.wsgi --workers 4 --bind 127.0.0.1:8001
# The sidecar for the async endpoints
granian --interface asgi --port 8002 mysite.asgi:application
Start there and get the hang of it. Then move more over to async later, and the complications start to show. The danger is diving in feet first without understanding that "it is an order of magnitude more complicated to correctly handle async code than to just code synchronously," with blocked event loops and deadlocks waiting for you.
Is any of this worth it below Instagram scale? Michael Kennedy's own servers suggest so. About 27 containers were using roughly nine gigs of RAM, with some web apps running purely synchronously on WSGI and others upgraded to true async on ASGI with Granian. On one web app, moving requests to ASGI with truly async calls down to the database let him cut workers, because each one was more capable and didn't get bound up waiting, and that saved about 500 MB.
Worker type is a related choice. Gunicorn with several worker processes keeps them separate and avoids GIL contention. Its threaded worker, gthread, runs one process with a pool of threads instead, with much less memory overhead than four processes because initialization and the rest are shared (Django still opens a connection per thread unless you configure a database pool):
gunicorn mysite.wsgi --worker-class gthread --workers 1 --threads 4
Which one is right depends on how much CPU work you do and how much the GIL gets in the way. Ask how to deploy a Django app and you'll get a different answer from every developer, for good reasons that trade off against each other.
“I think they're running their core application as WSGI and the standard ways because the scaling patterns there are so established and known.”
Carlton Gibson
Recap: an order of operations for scaling Django
Put the advice from this guide together and a sensible order falls out:
- Check the database first. If requests are slow, look at your query plans before reaching for parallelism, and make sure every hot path uses an index. psycopg also releases the GIL while it waits. See the real limits of async.
- Move slow work out of the request. Django Tasks with the database backend handles things like emails without a Celery cluster to babysit. See Django 6.0 Tasks.
- Add ASGI only where connections stay open. Server-sent events, WebSockets and streaming responses are the trigger, and a small sidecar next to a WSGI core is enough to start. See WSGI or ASGI and the hybrid deployment.
- Watch free threading. The architecture is in place and the remaining work is thread safety across the ecosystem. See free-threaded Python.
None of these steps asks you to rewrite your app as async.
Dark matter Django: how many Django projects are there?
How many people use Django? For an open source framework with no sign-up, that's a harder question than it sounds, and every obvious way to count has a hole in it.
Start with what's public. GitHub's "used by" count for Django shows a couple of million repositories, but that covers only public projects on GitHub. One estimate, from Jacob Kaplan-Moss at DjangoCon US (maybe 2024), is about 4 million active Django projects in the wild, though how it was derived is unclear. Private and internal apps, like the little company tool someone threw up for their team, probably push the real number higher, though nobody can prove it.
Why not just count PyPI downloads? Those figures used to be fairly representative, and they may now be skewed in both directions. CI pipelines and Docker builds can rack up a hundred downloads in a day without a single new project. Caching hides real installs just as easily: a Docker image built once and reused, uv's cache, or a local PyPI or pip cache where one download turns into a hundred installs. It's not even clear whether a cached install should count as one.
Telemetry could help, and an idea to add some to Django once floated around. It went nowhere, for the obvious reason that no one wants to go near it. So the project estimates.
The part that stands out is how small the visible slice is. The people Django can see - newsletter subscribers, survey respondents, DjangoCon attendees - number about 4,000 or 5,000. Against 4 million, that's roughly a thousandth. A release can break a third-party package (a CMS, an image library) and Django can't know unless people test the pre-release and report back. Regression reports used to land on release day that could have arrived a week earlier. A few thousand beta testers and survey takers are a tiny sample of a very large, very quiet user base. That unseen majority needs a name.
“I have a new term for you, Carlton. Dark matter Django.”
Michael Kennedy
Recap: grow into async, typing and the rest when your app earns it
So should you write async views today? Gently. Django is ready, but async isn't a cure-all, and most of what this guide covers is for the cases that need it. When problems show up at scale, they're async and GIL problems, not Django problems. The thread running through all of it is that you grow into complexity rather than start with it:
- Async is there when you need it, with a complete API (why the docs changed), and you can keep it inside one view (capping function coloring).
- Deployment can stay on well-understood WSGI, with ASGI added beside it only for long-lived connections (the hybrid setup).
- Background work can start with Django Tasks and the database you already run (Django Tasks).
- Structure and typing come when the model outgrows active record, not on day one (Django Mantle).
You don't have to add typing and you don't have to write async views, but there's space to grow into them. A framework shouldn't make you change language just because your application got more serious.
To go deeper, Talk Python Training's Async Techniques and Examples in Python covers async and await, asyncio, threads, multiprocessing and the GIL trade-offs behind this guide. Django: Getting Started teaches the ORM, views and templates underneath all of it, and HTMX + Django: Modern Python Web Apps, Hold the JavaScript fits the HTMX and template partials approach.