将django-socketio添加到现有的Apache / mod_wsgi / Django站点 [英] Adding django-socketio to existing Apache/mod_wsgi/Django site

查看:106
本文介绍了将django-socketio添加到现有的Apache / mod_wsgi / Django站点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以提供或链接到使用Apache和mod_wsgi的现有Django网站添加django-socketio功能的教程?



他们可以并行工作吗? runserver_socketio命令需要处理所有请求?



这个问题是相关的,但没有提供实用的信息。



谢谢

解决方案

您应该可以在Apache面向公共服务器的后面运行常规站点,而runserver_socketio部分仅在单独的端口上提供Websockets。如您所链接的问题所述,如果可以通过Web服务器代理websockets,如果这是您的要求,则需要解决,但是还提到了runserver_socketio使用的gevent服务器的功能更多。 p>

当运行这样的单独的实例时,带外功能将不起作用,因为它们依赖于共享状态:


$ b $

django_socketio.broadcast_channel(message,channel)
django_socketio.send(session_id,message)

您还需要将 SOCKETIO_PORT 添加到常规Django项目的设置中以便它知道要使用哪个端口。


Can anyone provide or link to a tutorial for adding django-socketio functionality to an existing Django site that uses Apache and mod_wsgi?

Can they work in parallel or does the runserver_socketio command need to handle all requests?

This Question is related but offers little practical information.

Thanks

解决方案

You should be able to run the regular site behind a public facing server like Apache, with the runserver_socketio part just serving websockets on a separate port. As described in the question you linked to, you'll need to work out if it's possible to proxy websockets through your web server if that's a requirement for you, but as also mentioned the gevent server used by runserver_socketio is more than capable.

When running separate instances like this, the "out of band" functions won't work, as they depend on shared state:

django_socketio.broadcast(message)
django_socketio.broadcast_channel(message, channel)
django_socketio.send(session_id, message)

You'll also need to add the SOCKETIO_PORT to the regular Django project's settings so that it knows which port to use.

这篇关于将django-socketio添加到现有的Apache / mod_wsgi / Django站点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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