开发者

What is the best method to tranfer data to a server from code

开发者 https://www.devze.com 2023-02-07 21:29 出处:网络
I\'m writing two Django applications: one that generates a lot of data in time, and another part that displays it. The app that generate it will run on a machine at my home and the one that displays t

I'm writing two Django applications: one that generates a lot of data in time, and another part that displays it. The app that generate it will run on a machine at my home and the one that displays the data will be a machine on the internet.

What do you believe it will be the best way to transfer the data from the application that generates the content (SQL entries + documents) to the ap开发者_JAVA百科plication that displays it ?

My fist thoughts are to somehow send it though FTP (from code) as a zip payload, and on the display server to have a cron that will periodically process the new payloads and merge the data to the existing one.

Any other ideas? I would prefer python/django


Setup two databases - one master and one slave. Write on the master and make the slave to sync with the master. This way you will not need to worry when your connection is down.


This is what RESTful web services are all about.

Your web server does two things.

  1. "displays the data". Presumably via HTML web pages. But maybe not. The question is too vague.

  2. Collects the data created by your application "that generates a lot of data in time". This is ordinary REST requests, usually using a POST, with authentication and a reasonable level of security.

Your application "that generates a lot of data in time" will do two things.

  1. "generates a lot of data in time". Whatever that means.

  2. Use urllib2 to make RESTful web service requests to your web server to provide that data which is displayed.

This is a really, really standard design pattern. That's how Amazon.com, eBay and just about every web site with RESTful API's works.

0

精彩评论

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