将django-socketio添加到现有的Apache / mod_wsgi / Django站点 [英] Adding django-socketio to existing Apache/mod_wsgi/Django site
问题描述
任何人都可以提供或链接到使用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屋!