【问题标题】:django python cumulus - How to deal with uploading a large number of files to cloud file storagedjango python cumulus - 如何处理上传大量文件到云文件存储
【发布时间】:2012-09-06 13:56:19
【问题描述】:

我在服务器上的临时文件夹中处理并保存了许多文件,现在我想将它们移动到我的 default_storage 位置(使用 django-cumulus 将 default_storage 设置为机架空间云文件)。

该过程开始正确上传文件,但在停止之前只管理不到一半的文件。我的猜测是它的内存问题,但我不知道如何去解决它。以下是相关代码:

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 云 nginx 和 gunicorn

【问题讨论】:

    标签: python django django-file-upload


    【解决方案1】:

    你可以试试django-storages。它是一个易于集成的自定义后端,还支持rackspace

    【讨论】:

      【解决方案2】:

      最终答案分为几个部分。首先,我必须向 cumulus 添加一个 TIMEOUT 设置(在 django-cumulus 文档中没有提到)。其次,我增加了 gunicorn 的超时时间。最后我增加了nginx的超时参数。

      【讨论】:

        猜你喜欢
        • 2019-05-06
        • 1970-01-01
        • 1970-01-01
        • 2010-12-30
        • 2012-02-17
        • 2018-10-10
        • 1970-01-01
        • 2012-04-17
        • 1970-01-01
        相关资源
        最近更新 更多