开发者

MySQL replication and Django FileField

开发者 https://www.devze.com 2023-01-25 01:33 出处:网络
I have MySQL replication setup, and it replicates nicely the database data. However, I also use FileField and ImageField, and have file load开发者_StackOverflowed onto the FS. I probably will just use

I have MySQL replication setup, and it replicates nicely the database data. However, I also use FileField and ImageField, and have file load开发者_StackOverflowed onto the FS. I probably will just use rsync to manually replicate this, but is there a better way?

I know of key value storage. But for this project, I am looking to minimize the number of technologies involved and stick with simple options. I've successfully used rsync for this before, but I was wondering if others who have done this have any new cool tools (or even rsync wrappers) that work better.

Your experiences are appreciated.


I haven't searched to see if anyone has already done this, but you can write your own code in Django to remotely copy the file to your goal server (i.e. SFTP).

  • Option 1 on this front: create your own Form Field that extends the Image and File field that does this uploading.
  • Option 2: in your form/view, call some additional function that does the uploading.
  • Option 3: override something in Django code to handle this automatically for Image and File fields (probably not recommended, unless there is some slick way I'm not thinking of).
  • Here's info on using SFTP in Python: SFTP in Python? (platform independent)

    If you're using something like Amazon's CloudFront or Buckets, then you can use Boto to handle the uploading (I believe): http://aws.amazon.com/code/827?_encoding=UTF8&jiveRedirect=1 (if not, there are probably other python libraries to help).

    0

    精彩评论

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