Django /彗星(推):最坏的一切? [英] Django / Comet (Push): Least of all evils?

查看:123
本文介绍了Django /彗星(推):最坏的一切?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读了有关Django和HTTP Push的所有问题和答案。然而,没有一个提供一个清晰,简明的,从头到尾的解决方案,关于如何完成所谓的彗星功能的基本的你好世界。

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 basic "hello world" of so-called "comet" functionality.

问题(1):HTTP在什么程度上不是(至少到目前为止)为此做的?所有潜在的解决方案是否基本上都是黑客?

First question (1): To what extent is the problem that HTTP simply isn't (at least so far) made for this? Are all the potential solutions essentially hacks?

2)目前最好的解决方案是什么?

2) What's the best currently available solution?


  • Orbited?

  • 其他一些基于Twisted的解决方案?

  • 龙卷风?

  • node.JS?

  • XMPP w / BOSH?

  • Orbited?
  • Some other Twisted-based solution?
  • Tornado?
  • node.JS?
  • XMPP w/ BOSH?

其他解决方案?

3)nginx推送模块如何进入这个讨论?

3) How does nginx push module play into this discussion?

4)这些解决方案中的哪一个需要更换典型的mod_wsgi / nginx(或apache)部署模式?为什么要这样做?这是否有利于过渡?

4) Which of these solutions require replacement of the typical mod_wsgi / nginx (or apache) deployment model? Why do they require this? Is this a favorable transition in any case?

5)使用已经在Python中的解决方案的优势有多重要?

5) How significant are the advantages of using a solution that is already in Python?

Alex Gaynor来自PyCon 2010的演讲,我刚刚看过blip.tv,它是惊人而丰富的信息,但并不能说明Django当前HTTP Push的状态。有一件事他对我有一个信心是这样的:Orbited做了很好的抽象和模拟网络套接字的概念。因此,当WebSockets实际着陆时,我们将处于过渡的好地方。

Alex Gaynor's presentation from PyCon 2010, which I just watched on blip.tv, is amazing and informative, but not terrifically specific on the current state of HTTP Push in Django. One thing that he said that gave me some confidence was this: Orbited does a good job of abstracting and simulating the concept of network sockets. Thus, when WebSockets actually land, we'll be in a good place for a transition.

6)HTML5 Websockets与当前的解决方案有何不同? Gaynor对于Orbited的轻松过渡的评估是否准确?

6) How does HTML5 Websockets differ from current solutions? Is Gaynor's assessment of the ease of transition from Orbited accurate?

推荐答案

我不敢相信自从我问这个问题。

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

与Django异常(以及相关的网络流量,例如websockets)一直是社区中许多人的痒。我已经采取了这几年,除其他外,刮伤这个痒。

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是一个运行在Twisted上的WSGI / ASGI并发器。这是一个主要由5名爱好者驱动的项目,来自一些有远见的组织的帮助和资助。今天正在生产数十个,但不是数百个公司。

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:


  • 它基于Twisted,不需要知道或使用Twisted内部, / li>
  • 它只是工作,因为您不需要任何特殊的服务器或进程配置来执行来自Django(或金字塔或Flask)应用程序的异步和套接字流量

  • 很有可能与ASGI(Django Channels标准)向前兼容,并且以某种有意义的方式与第一个ASGI容器

  • 简单的API可以保持您的视图逻辑的流程,并且易于单元测试。

请参阅这个讲话,我在Django-NYC(在Buzzfeed办公室)给了mor关于为什么我认为这是这个问题的最佳答案的信息。

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.

这篇关于Django /彗星(推):最坏的一切?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆