I am creating a python app with chat application. The chat application relies on tornado only. But the chat requires various database access and Django ORM do this beautifully.I am using tornado websockets for chat. So I have following options:
So what should be the best way to merge these two frameworks so they both works good without much change and performance issues.
It depends on how many times you require to access Django functions from tornado process. If such access count is low, then first approach is better. And if large, then choose second.
But i would try to implement the first approach, because:
To my mind, it will be better to implement some REST API at django side and at tornado side, and these processes will communicate via this API with each other. Try to design your architecture in such a way, that you'll need to use this API as rare as possible.
I would recommend to check (or maybe even use) project called centrifuge. It is build on top of tornado and it provides means for implementing real time messages. It has REST api, so you can control it from any other process. In this answer django+centrifuge workflow is described: https://stackoverflow.com/a/26930534/821594
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With