Reputation: 41745
A client talks to Django, and django uses node.js to do some javascript related work to give back the client a http response.
I wonder how I should set up the link(?) between the django and node.js.
Simply, I could use python's requests library and talk http, but is this best I can do?
If I were to build the communication link in c++, I would create non-block socket with Send/Recv Thread and use mutex(or similar) between the django view code and the send/recv thread.
I guess that's what is called asynchronous io
in node.js world.
Is there a similar thing in python so that I could use on django side to talk to another server?
I heard many big companies use Thrift
, would it fit here?
I also see gevent
might be relevant keyword here, but not sure.
Upvotes: 1
Views: 813
Reputation: 3536
I am not sure if my answer is still relevant, but I'll give it a try. IMHO, the best solution for you would be to have a RESTful API for your Django app. This has several advantages:
If you don't want to build a RESTful API, python's request library is probably the best and easiest way.
Good luck.
Upvotes: 1