Django Channels
The official Django project that swaps WSGI for ASGI so your app can handle WebSockets, long-polling, and background tasks.
Repository Health
Technical Analysis
Django Channels is an official Django project that extends Django’s synchronous, request/response model with ASGI-based asynchrony. It replaces the single “one request in, one response out” cycle with a general system for handling more kinds of connections — including WebSockets, HTTP long-polling, and chat protocols — while letting you write both a HTTP application and a WebSocket application in the same project, using the same authentication and session systems Django already provides.
It introduces a routing layer (ProtocolTypeRouter) that dispatches incoming connections by protocol type to consumers you write, plus optional channel layers (typically backed by Redis via the companion channels_redis package) for broadcasting messages between consumers and worker processes. Maintenance is overseen by the Django core team, with Daphne as the reference ASGI server and asgiref as the shared low-level ASGI library.
What You Get
- A
ProtocolTypeRouterthat dispatches connections to different consumers based on protocol (HTTP, WebSocket, etc.) - Sync and async
Consumerbase classes for writing per-connection logic in familiar Django-style class-based views - Built-in reuse of Django’s authentication and session middleware inside the ASGI/WebSocket stack
- Channel layers (via
channels_redis) for broadcasting messages across consumers and background worker processes - A
testingmodule for writing async tests against WebSocket consumers - Compatibility with Daphne and other ASGI servers for production deployment
Common Use Cases
- Adding live chat, notifications, or activity feeds to an existing Django application without switching frameworks
- Building real-time dashboards that push server-side updates to connected browsers over WebSockets
- Offloading long-running or background work to async workers that communicate with the web tier via a channel layer
- Handling long-poll HTTP connections for legacy clients that can’t use WebSockets directly
Under The Hood
Architecture: The core of Channels is channels/routing.py’s ProtocolTypeRouter, which is itself a valid ASGI application that inspects the incoming ASGI scope’s protocol type and dispatches to a nested URL router or consumer accordingly; channels/consumer.py defines the base Consumer/AsyncConsumer classes that map incoming events to handler methods much like Django’s class-based views map HTTP verbs. Session and auth support (channels/sessions.py, channels/auth.py) wraps Django’s existing middleware so WebSocket connections carry the same request.user and session semantics as HTTP views.
Tech Stack: Channels 4.x targets Python 3.10+ and Django 5.2+, and depends on the lightweight asgiref package for the core ASGI primitives; it deliberately ships without a bundled channel-layer backend, pushing Redis-based pub/sub into the separate channels_redis package to keep the core dependency-light. Daphne, also maintained under the django GitHub org, is the reference production ASGI server for Channels-based projects.
Code Quality: The tests/ directory contains 29 test modules covering routing, consumers, generic views, sessions, security, and the testing utilities themselves, run via tox across supported Python/Django version combinations in CI. The codebase is comparatively small (~5,300 lines of Python) and readable, following Django’s own naming and structuring conventions closely, though maintenance commit volume has slowed as the project has matured (commits_per_month ~2).
API Design: Because consumers mirror Django’s class-based-view pattern, developers already familiar with Django views can pick up WebSocket handling with very little new API surface — the routing.py you write looks like urls.py, and a WebsocketConsumer subclass looks like a View subclass with connect/receive/disconnect methods instead of get/post.
Used by 4 apps in this directory
authentik
Authentication · Security
The self-hosted Identity Provider that replaces Okta, Auth0, and Entra ID with a unified SSO platform supporting SAML, OAuth2/OIDC, LDAP, RADIUS, and WebAuthn.
Baserow
No Code Platforms · Databases
Open-source no-code platform to build databases, apps, automations, and AI agents — self-hosted or cloud, with full data ownership.
Paperless-ngx
Bookmarks Archiving
Turn your paper pile into a searchable digital archive with OCR, AI classification, and automated workflows — all running on your own server.
SWIRL
Search · Databases · Data Engineering
Federated AI search and RAG across 100+ enterprise sources—no data extraction, no vector database required.