开发者

Is there a nice way to exchange django objects between 2 servers?

I have 2 django servers, with their own database, I want to exchange some specific objects between them over the http protocol. Actually, I planed to create some views to generate XML output on one side to be imported on the other开发者_StackOverflow社区 side. Is there a nicer way ?


Is there a reason this needs to happen through http?

If you just want to read data from one server to be used on the other, you could create a simple API that returns a representation of the object you queried for (in xml/json or whatever other format you wanted).

If there is going to be a decent amount of processing going on, or slow communication, and you don't need it to happen real time (in the request/response cycle), you could look at a message queue. Something like RabbitMQ for instance.

If you want both servers to have direct access to both databases, you could try to take advantage of Django's multiple database support.

If it's more of a one-off copy of data, just write a small (non-Django) script to do it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜