Django_Socketio和Apache [英] Django_Socketio and Apache

查看:377
本文介绍了Django_Socketio和Apache的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是pretty新的Web开发。最近我一直在使用Django的站点。我是在网站上实施的WebSockets很感兴趣。在 https://github.com/stephenmcd/做到这一点我使用的Django socketio(上git的枢纽可用Django的socketio )。所有这一切都是使用的建议在Django的socketio文件GEVENT的pywsgi服务器做工精细。

I'm pretty new to web development. Lately I have been making a site using Django. I was very interested in implementing websockets in the site. To achieve this I was using django-socketio (available on git hub at https://github.com/stephenmcd/django-socketio). All this was working fine using gevent's pywsgi server which is suggested in the django-socketio documents.

从阅读Django的一些书籍,似乎它是推荐使用Django与Apache和mod_python部署。此刻我不确定着手把Django中,Apache和共同的WebSockets的最佳途径。我应该使用pywsgi服务器来处理的旁边正在运行Apache服务于项目的其余部分的Django的socketio插座?有没有在Apache可以搞定一切的方法吗?如果我只是不使用Django的Socketio?我真的想使用Django和Apache,因为我知道一些关于他们。这是很多比我更了解别的:D

From reading some books on django it seems that it is recommend to use Django with Apache and mod_python for deployment. At the moment I am unsure of the best way to go about bringing Django, Apache and websockets together. Should I be using the pywsgi server to handle the django-socketio sockets running along side apache to serve the rest of the project? Is there a way in which Apache can handle everything? Should I just not use Django-Socketio? I would really like to use Django and Apache because I know a little about them. Which is a lot more than I know about anything else :D

反正我的问题是真的如果有人知道如何使用Django的socketio和Apache,所以我可以让我的头周围的任何话题好的文章或文档?

Anyway my question is really if anybody knows any good articles or documentation on using Django-socketio and Apache so I can get my head around the topic?

感谢您。

推荐答案

首先,什么你阅读提示mod_python的高度过时。它不再开发和使用Apache时mod_wsgi的是正确的做法。

To start with, anything you read suggesting mod_python is highly out-dated. It's no longer developed and mod_wsgi is the right approach when using Apache.

据我所知,mod_wsgi的不支持WebSockets的需要打开的连接类型。在谷歌快速搜索显示,有办法得到的WebSockets Apache下工作,但至于如何将与GEVENT / Django的堆栈socketio工作是你就需要探讨的问题。

As far as I'm aware, mod_wsgi doesn't support the type of open connections required by WebSockets. A quick search on Google shows that there are ways to get WebSockets working under Apache, but as to how well that would work with the gevent/django-socketio stack is something you'd need to look into.

我在Django的socketio文档建议,用于处理WebSocket的连接,我会建议使用GEVENT的服务器。基准应采取与一粒盐,但如果你看看这些结果你会发现GEVENT是与mod_wsgi的相提并论。

I would suggest using gevent's server as I recommended in the django-socketio docs, for handling the WebSocket connections. Benchmarks should be taken with a grain of salt, but if you take a look at these results you'll find gevent to be on par with mod_wsgi.

Django的socketio提供让你成为通过一个单一的应用程序实例WebSocket的连接以及定期Django的意见的便利。如果不适合你,你可以实现这些作为单独的项目,并运行在Apache / mod_wsgi的常规Django的一部分。

django-socketio provides the convenience of letting you serve the WebSocket connections as well as regular Django views through a single application instance. If that doesn't suit you, you could implement these as separate projects, and run the regular Django part under Apache/mod_wsgi.

这篇关于Django_Socketio和Apache的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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