9

I have a django application need to be deployed under Apache HTTP Server, also i need push event to client's web browser at real time. I'm rather new to python, could anyone suggest some websocket server could work in Python+Django+Apache?

2 Answers 2

10

Django is a synchronous web server. it means you cannot use websocket directly with it. But you have various option to do websocket in Django.

Use a full python stack to do it: use Tornado and Django. You can follow this post

Use Nodejs + socket.io + message broker : Follow this type of tutorial

You will find more resources to help you doing that with node.js & socket.io than using tornado.

Sign up to request clarification or add additional context in comments.

8 Comments

the environment i must use is python+django, django could be easily deployed on Tornado? The second option seems more complex?
The second option add complexity in your web stack: it means that added to python you have to deal with javascript langage. plus you'ill use a message broker (redis). It depends of your need. If you are more confortable with python, go with Tornado. Tornado can run Django server with no problem. See this link.
Thanks Alex, i will go 1st option for a try now. I know socket.io should perform better than Tornado, is that true? In the future i will also give the second option a try.
Which option do you suggest to be used in production environment? Stability is most important, performance second.
Well. The only thing I can tell is that socket.io is really well supported by all browser ;)
|
2

With the new update (Django 1.10) Django does now support websockets.

Please read this article for more information: In deep with Django channels - the future of real time apps in Django

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.