Understanding asynchronous Python and Django: a roadmap

A collection of curated links to make a sense of the asynchronous Python scene.

The asynchronous Python landscape is terribly confusing even for developers coming from other languages where the asynchronous model is strong.

This is a collection of links, ordered as a roadmap by incremental level of difficulty. Enjoy!

Understanding asynchronous Python: the basics

To start off, if you're completely new to the asynchronous vs synchronous model in Python, you should watch Asynchronous Python for the Complete Beginner by Miguel Grinberg. It is one of the most beginner-friendly introductions to the topic.

By the same author Sync vs. Async Python: What is the Difference? is a slimmed down written version of the talk.

Understanding asynchronous Python: digging deeper

After having grokked the basics you should absolutely watch this fantastic playlist by Łukasz Langa, Python core developer: import asyncio. I highly suggest starting from episode one, where he introduces the basics, as well as the pivotal moments that lead to async/await in Python 3.5.

It's crazy to see how many PEPs and experiments it took to reach async/await in Python.

Subsequent episodes build gradually to give you a complete understanding of event loops in Python, coroutines, and what not.

Understanding asynchronous Python: ASGI and Django

We all love Django don't we? Django 3.1 landed with support for asynchronous views, which is pretty exciting.

Tom Christie (Django REST framework, Starlette, HTTPX) wrote a nice Hello, ASGI introduction to ASGI, the asynchronous interface for Python applications.

After meeting ASGI, it's time to learn more about asynchronous Django. Start from this talk, again, by Tom Christie: Sketching out a Django redesign.

Tom also talks in this episode of Django Chat, Django async future in which he outlines how Django will look in the future with full async support.

Would be remiss not to mention this episode of Django Chat with Andrew Godwin. Andrew is behind much of the asynchronous effort in Django.

Andrew also wrote the ASGI specification and the original proposal for adding asynchronous support to Django. You should read both documents, quite educational.

Understanding asynchronous Python: Channels and Django

Django Channels play an important role in the asynchronous Django ecosystem. This is not going to change in the future, even if Django will become (almost) fully asynchronous one day or another.

This is a piece you can't skip. Iacopo Spalletti gave a nice talk about Channels: Building real time applications with Django. Start here to learn more.

Understanding asynchronous Python: opinions

Learned all the async Python? It's time for (strong) opinions! Don't get fooled by benchmarks, as Tom Christie explains in Beyond developer tribalism.

Also, you might be interested in why Armin Ronacher (Flask) doesn't feel the async pressure.

Did I miss something? Feel free to reach me out on Twitter or Telegram.

Valentino Gagliardi

Hi! I’m Valentino! Educator and consultant, I help people learning to code with on-site and remote workshops. Looking for JavaScript and Python training? Let’s get in touch!

More from the blog: