Django上传失败请求数据读取错误 [英] Django upload failing on request data read error

查看:138
本文介绍了Django上传失败请求数据读取错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Django应用程序接受来自 jQuery uploadify 的上传,这是一个使用Flash的jQ插件上传文件并提供进度条。

I've got a Django app that accepts uploads from jQuery uploadify, a jQ plugin that uses flash to upload files and give a progress bar.

大约150k的文件工作,但更大的文件总是失败,几乎总是在大约192k(这是3个块)完成,有时在约160k。我得到的异常在下面。

Files under about 150k work, but bigger files always fail and almost always at around 192k (that's 3 chunks) completed, sometimes at around 160k. The Exception I get is below.

exceptions.IOError
request data read error
File "/usr/lib/python2.4/site-packages/django/core/handlers/wsgi.py", line 171, in _get_post
    self._load_post_and_files()
File "/usr/lib/python2.4/site-packages/django/core/handlers/wsgi.py", line 137, in _load_post_and_files
    self._post, self._files = self.parse_file_upload(self.META,     self.environ[\'wsgi.input\'])
File "/usr/lib/python2.4/site-packages/django/http/__init__.py", line 124, in parse_file_upload
    return parser.parse()
File "/usr/lib/python2.4/site-packages/django/http/multipartparser.py", line 192, in parse
    for chunk in field_stream:
File "/usr/lib/python2.4/site-packages/django/http/multipartparser.py", line 314, in next
    output = self._producer.next()
File "/usr/lib/python2.4/site-packages/django/http/multipartparser.py", line 468, in next
    for bytes in stream:
File "/usr/lib/python2.4/site-packages/django/http/multipartparser.py", line 314, in next
    output = self._producer.next()
File "/usr/lib/python2.4/site-packages/django/http/multipartparser.py", line 375, in next
    data = self.flo.read(self.chunk_size)
File "/usr/lib/python2.4/site-packages/django/http/multipartparser.py", line 405, in read
    return self._file.read(num_bytes)

在Django开发服务器上本地运行时,大文件可以正常工作。

我试过设置我的 FILE_UPLOAD_HANDLERS =( django.core.files.uploadhandler.TemporaryFileUploadHandler,)如果是内存上传处理程序,但没有任何区别。

When running locally on the Django development server, big files work.
I've tried setting my FILE_UPLOAD_HANDLERS = ("django.core.files.uploadhandler.TemporaryFileUploadHandler",) in case it was the memory upload handler, but it made no difference.

有没有人知道如何解决这个问题?

Does anyone know how to fix this?

推荐答案

问题可能是:


  • 您的互联网连接(一些防火墙阻止大型上传,只是尝试上传到其他一些服务来测试)。


  • 您的网络服务器(或许您的网络服务器禁止大量上传?)

所以...要更有帮助,你必须给我们一些关于哪个部分的问题(应该是相当容易测试)的信息,如果它是网络服务器(我' m猜测)你正在运行什么样的网络服务器,什么样的Python处理程序(mod_wsgi,mod_python,fastcgi等)。

So... to be a bit more helpful you'll have to give us some info about which part is the problem (should be fairly easy to test) and if it's the webserver (which I'm guessing) what kind of webserver you're running, what kind of Python handler (mod_wsgi, mod_python, fastcgi, etc..)

这篇关于Django上传失败请求数据读取错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆