by This is exciting for everyone who’s been waiting on the edge of their seats ever since Andrew Godwin’s DEP 0009 was approved by Django Technical Board in July 2019.

This means you can use any combination of async and sync views, and Django will guarantee that the execution is always done in the right execution context.

You can also use the goodness of async in your middleware functions: Since middleware can support any combination of sync and async requests, Django will try to fit the middleware’s requirements if only one type of requests are supported (like only async requests in the example above) — but at a performance penalty.

With this release, you can actually put async code in production if you don’t have to do heavy-lifting with some parts of Django that don’t support async yet.

Related Articles