PyCon 2016 in Portland, Or
hills next to breadcrumb illustration

Monday 4:15 p.m.–5 p.m.

Reinventing Django for the Real-Time Web

Andrew Godwin

Audience level:
Intermediate
Category:
Web Frameworks

Description

Django has long been tied to the request-response pattern, but the upcoming "channels" project changes this and allows Django to natively support WebSockets, running tasks after responses, easily handle long-polling and more. Come and learn about the design, how we're trying to keep things as Django-like as possible, and how you can use it in your projects.

Abstract

Ever since the first release ten years ago, Django has been built around a request-response cycle; a request comes in, your view processes it, and returns a response. As we move into the era of WebSockets and push messaging, however, this is no longer a good enough abstraction. The Django Channels project is a rewrite of Django's lowest level to enable native support for protocols like WebSockets, while retaining Django's nice view model and not making developers write low-level asynchronous code. As a bonus, it also enables offloading of tasks outside the request-response cycle; for example, thumbnailing images after they're uploaded and a successful response is returned. The talk will cover: - The landscape today and the basic WSGI/view abstraction - The challenges WebSockets and similar protocols bring - How Channels maps these concepts into a familiar view-like layer - Examples of using Channels to do things like chat rooms, live blogs, and delayed thumbnailing - Deploying Channels at scale and how it can actually improve performance