How to save upload files to another server

后端 未结 2 1711
抹茶落季
抹茶落季 2021-01-22 09:10

I\'m currently using django. And now I need to save a file uploaded by a user to another server which is not the one that serves the django application. The file will be saved

2条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-22 09:48

    Default Django behavior is to save file on the filesystem, not the database itself).

    You have several options how to do this, the simplest one is to have a filesystem exported from you "other" machine and mounted on the machine with the django application.

    For the filesystem export you can use NFS, MogileFS or GlusterFS (which I'm using) or many more :). If you do not need real-time save&serve, simple rsync may be an option too.

    Second option is to utilize existing django mechanisms StogareAPI. There are already available different storage backeds you can use and may be helpful for you (e.g. ftp).

提交回复
热议问题