Adding Socket.IO to an existing Django / WSGI project

This guy seems to be trying to do the same, but the answer to his question is not clear enough. I'm not all familiar with setting up socket servers, so I'm still a little lost here. Has anyone done this before? How do you deploy and maintain a socket server?

I wanted to comment on his post and ask him if he has any success, but I don't have enough reputation yet.

+1


source to share


2 answers


My final solution for this was to use a built in command runserver_socketio

for a manage.py

script running on 0.0.0.0:9000

. I am using Ubuntu, so I made an upstart config to support it. It seems to work pretty well, working alongside my Apache / WSGI server. If anyone has a better solution please do speak.



+1


source


The approach I came up with was using wsgi, which apache uses for a thread instance, which just calls the runerver_socketio command. This is, of course, the best approach. But if someone finds a better solution. Let us know in this post.



def init_socketio():
    os.system('python manage.py runserver_socketio 0.0.0.0:9000')

socketio_thread = Thread(target=init_socketio, args=())
socketio_thread.start()

      

0


source







All Articles