如何将上传文件保存到其他服务器 [英] How to save upload files to another server
问题描述
默认的Django行为是保存文件系统上的文件,而不是数据库本身) 。
你有几个选择如何做到这一点,最简单的就是从你的其他机器上导出一个文件系统,并用django应用程序挂载到机器上。
对于文件系统导出,您可以使用NFS,MogileFS或GlusterFS(我正在使用)或更多:)。第二种选择是利用现有的Django机制 //docs.djangoproject.com/en/dev/ref/files/storage/rel =nofollow> StogareAPI 。已经有已经提供不同的存储备份可以使用,并可能对您有所帮助(例如ftp)。
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 to file system not the database. Could somebody tell me how to do this?
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).
这篇关于如何将上传文件保存到其他服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!