Inside web framework: intro to the ASGI spec, middleware and apps
summary
Covers the ASGI specification for asynchronous web apps and how it powers frameworks like FastAPI and Django; explains ASGI message flow and lifecycle. Shows how to implement a minimal ASGI app in plain Python, how to write custom ASGI middleware for tasks like authentication or request-body handling, and how to serve ASGI apps programmatically using Uvicorn and manage the event loop.
AI-written summary · about
chapters (17)
- 0:00Start
- 3:15What is the ASGI spec?
- 4:05ASGI Scope
- 5:07ASGI Receive
- 6:17Objects as applications
- 6:50Server Stub
- 9:04Streaming echo app
- 10:23Motivation
- 13:57Starlette & middleware
- 15:03Read/modify scope
- 16:30Wrap request body
- 17:40Wrap response
- 19:00Storing state in middleware
- 19:39Request scope
- 20:07Sharing state- per lifespan
- 21:48On the middleware itself
- 23:00Helper functions
related talks
31mInside ASGI The Engine Behind Modern Python Web Frameworks
18mFrom WSGI to ASGI - Django 3.0
31mHey, Python-Web-Community! What's going on?
26mImplementing shared functionality using Middleware
47mASGI in depth
24mA Brief History of Python Web Frameworks
26mUsing Django as a Micro-Framework: Hacking on the HTTP handlers..
23mµDjango, an Asynchronous Microservices Technique with Practical Examples
