Adding django-socketio to existing Apache/mod_wsgi/Django site

╄→гoц情女王★ 提交于 2019-12-22 11:22:45

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/9840175/adding-django-socketio-to-existing-apache-mod-wsgi-django-site

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!