It depends on how many times you need access to Django features from the tornado process. If such an access indicator is small, then the first approach is better. And if large, then choose the second.
But I would try to implement the first approach, because:
- Most of the project logic will be in the django project. A tornado will simply provide a means of communication
- If you access the database from a tornado, you will need to synchronize your django models and your tornado models. In addition, in a tornado, it is better to use the async database driver. Thus, the first approach will avoid this pain.
In my opinion, it would be better to implement some REST API on the django side and on the tornado side, and these processes will interact through this API with each other. Try to design your architecture in such a way that you will need to use this API as little as possible.
I would recommend checking out (or maybe even using) a project called centrifuge . It is built on top of a tornado and provides facilities for real-time messaging. It has a REST api, so you can control it from any other process. This answer describes the django + centrifuge workflow : fooobar.com/questions/616866 / ...
source share