Django / Comet (Push): Least of all evils?

后端 未结 4 732
滥情空心
滥情空心 2020-11-28 02:07

I have read all the questions and answers I can find regarding Django and HTTP Push. Yet, none offer a clear, concise, beginning-to-end solution about how to accomplish a b

4条回答
  •  南方客
    南方客 (楼主)
    2020-11-28 02:32

    I can't believe it's been over six years since I asked this question.

    Async with Django (and the associated network traffic, eg websockets) has been an itch for many of us in the community. I have taken these past few years, to among other things, scratch this itch.

    hendrix

    hendrix is a WSGI/ASGI conatiner that runs on Twisted. It has been a project mainly driven by 5 enthusiasts, with help and funding from some visionary organizations. It is in production today at dozens, but not hundreds, of companies.

    I'll leave it to you to read the documentation to see why it's the best solution to this problem, but a few quick highlights:

    • it's based on Twisted, requires no knowledge or use of Twisted internals, but leaves them all available
    • It "just works" in the sense that you don't need any special server or process configuration to do async and socket traffic from within your Django (or Pyramid, or Flask) app
    • It is very likely to be forward-compatible with ASGI, the Django Channels standard, and is in some meaningful ways the first ASGI container
    • It ships with simple APIs that maintain the flow of your view logic and are easy to unit test.

    Please see this talk that I gave at Django-NYC (at the Buzzfeed offices) for more information about why I think this is the best answer to this question.

提交回复
热议问题