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

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

问题描述

任何人都可以提供或链接到一个教程将Django的socketio功能,使用Apache和mod_wsgi的?现有的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?

他们能并行工作还是在runserver_socketio命令需要处理所有的请求?

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.

感谢

推荐答案

您应该能够像Apache一个面向公众的服务器运行背后的正规网站,与runserver_socketio部分只是一个单独的端口上的WebSockets提供服务。正如您链接到的问题描述,你需要通过你的Web服务器,是否有可能代理的WebSockets如果这是对你的要求,但还提到runserver_socketio使用的GEVENT服务器能者多。

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)

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

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天全站免登陆