我在服务器上的temp文件夹中处理并保存了许多文件,现在我想将它们移动到我的default_storage位置(使用django-cumulus将default_storage设置为rackspace云文件)。
该进程开始正确上载文件,但在停止之前仅管理了不到一半的文件。我的猜测是这是一个记忆问题,但我不确定如何去解决它。相关代码如下:
listing = os.listdir(path + '/images')
listing.sort()
for infile in listing:
image = open(path + '/images/' + infile, 'r')
image_loc = default_storage.save(infile, ContentFile(image.read()))
image.flush()
image.close()以防有什么不同,我的服务器设置是在ubuntu上的rackspace cloud nginx和gunicorn
发布于 2012-09-16 01:27:00
最后,答案分成了几个部分。首先,我必须为cumulus添加一个超时设置(在django-cumulus文档中没有提到)。第二,我增加了黑角兽的超时时间。最后,我增加了nginx的超时参数。
发布于 2012-09-06 22:04:02
你可以试一试django-storages。它是一个易于集成的自定义后端,也支持rackspace。
https://stackoverflow.com/questions/12301731
复制相似问题