django-flosse logo

django-flosse

Dead-simple Server-Sent Events for Django via a single decorator.

from django_flosse import sse_stream

@sse_stream
def live_feed(request):
    for item in my_data_source():
        yield ("update", {"value": item})

# ✨ Async support in v0.2.0+
@sse_stream
async def live_feed_async(request):
    async for item in my_async_data_source():
        yield ("update", {"value": item})
  • Install in seconds

    pip install django-flosse
    
    No INSTALLED_APPS changes required. Supports Django 4.2 – 6.0.

  • Zero boilerplate

    One decorator. Your generator yields events. Headers, permissions, errors — all handled. Works with def or async def.

  • Zero threads

    Iterates your generator directly in the worker. No queues. No background processes. Native async support for ASGI servers.

  • Built-in permissions

    IsAuthenticated, IsAdminUser, or bring your own BaseSSEPermission subclass. Async-compatible out of the box.

New in v0.2.0

🎉 Async generator support is here! Write async def streams with @sse_stream — no extra config. Learn more: Async Support Guide