Taking Django Async
summary
Channels 2.0 makes Django async-native by adopting asyncio, ASGI and a redesigned channel layer, with a ~75% rewrite that runs in production. Key tools are sync_to_async (thread‑pool execution) and async_to_sync (marshalling back to the main event loop). Redis remains an optional channel layer. Beware thread defaults—large CPU counts spawn many DB connections—but the new ASGI model and bridging functions prove the approach workable.
AI-written summary · about
chapters (17)
- 0:00Intro
- 1:46Adds async protocol support to Django Headline protocol is WebSockets Also allows background jobs
- 2:51Python 2.7 compatible Twisted for webserver Synchronous Django code
- 6:59Asyncio-native Python 3.5 and up Supports async coroutines and sync threads
- 8:4175% rewrite
- 9:06Async interfaces are separate to sync
- 13:02Async-native most of the way
- 14:26Synchronous code has to run in threads
- 15:43Calling the ORM Rendering templates Handing off to Django views
- 17:01Async code runs on the event loop
- 19:58Both async and sync code are useful
- 26:59Turtles all the way down
- 28:48How much can we make async?
- 30:18What does an async ORM look like?
- 33:39Do we need to replace WSGI?
- 35:44Multiple servers (daphne, uvicorn) Multiple frameworks (Django. -?)
- 38:35What is Django?
related talks
27mTaking Django Async
29mTaking Channels Async
22mDjango Channels Teaching a mature framework new tricks
31mReinventing Django for the Real-Time Web
12mHacking Django Channels for Fun (and Profit)
29mBuilding real time applications with Django
45mWebSockets: Intro to Messaging
26mSync or async? Feel the magic of coroutines and the event loop in Django
