- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
尝试将数据加载为 Excel 作为响应时,出现 IO 请求数据读取错误。
def convert_to_excel(request):
field = forms.CharField()
try: data = field.clean(request.POST.get('exceldata', ''))
except: data = u''
response = render_to_response("spreadsheet.html", request= request, dictionary = locals())
filename = "%s%s.xls" % ("report_excel", datetime.datetime.today().strftime('%Y%m%d%H%M%S'))
response['Content-Disposition'] = 'attachment; filename='+filename
response['Content-Type'] = 'application/vnd.ms-excel; charset=utf-8'
return response
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 89, in get_response
response = middleware_method(request)
File "/usr/local/lib/python2.7/dist-packages/newrelic-1.2.1.265-py2.7.egg/newrelic/hooks/framework_django.py", line 191, in __call__
result = self.__wrapped(*args, **kwargs)
File "/home/core/mysite/src/task/tools/libs/pagination/middleware.py", line 8, in process_request
request.page = int(request.REQUEST.get('page', 1) )
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 166, in _get_request
self._request = datastructures.MergeDict(self.POST, self.GET)
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 180, in _get_post
self._load_post_and_files()
File "/usr/local/lib/python2.7/dist-packages/django/http/__init__.py", line 360, in _load_post_and_files
self._post, self._files = self.parse_file_upload(self.META, data)
File "/usr/local/lib/python2.7/dist-packages/django/http/__init__.py", line 320, in parse_file_upload
return parser.parse()
File "/usr/local/lib/python2.7/dist-packages/newrelic-1.2.1.265-py2.7.egg/newrelic/api/function_trace.py", line 82, in __call__
return self._nr_next_object(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/http/multipartparser.py", line 161, in parse
data = field_stream.read()
File "/usr/local/lib/python2.7/dist-packages/django/http/multipartparser.py", line 301, in read
out = ''.join(parts())
File "/usr/local/lib/python2.7/dist-packages/django/http/multipartparser.py", line 285, in parts
yield ''.join(self)
File "/usr/local/lib/python2.7/dist-packages/django/http/multipartparser.py", line 316, in next
output = self._producer.next()
File "/usr/local/lib/python2.7/dist-packages/django/http/multipartparser.py", line 449, in next
for bytes in stream:
File "/usr/local/lib/python2.7/dist-packages/django/http/multipartparser.py", line 316, in next
output = self._producer.next()
File "/usr/local/lib/python2.7/dist-packages/django/http/multipartparser.py", line 377, in next
data = self.flo.read(self.chunk_size)
File "/usr/local/lib/python2.7/dist-packages/django/http/__init__.py", line 384, in read
return self._stream.read(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 104, in read
result = self.buffer + self._read_limited(size - len(self.buffer))
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 92, in _read_limited
result = self.stream.read(size)
File "/usr/local/lib/python2.7/dist-packages/newrelic-1.2.1.265-py2.7.egg/newrelic/api/web_transaction.py", line 349, in read
data = self.__input.read(*args, **kwargs)
IOError: request data read error
最佳答案
检查你的 apache 配置,看看你是否能找到 LimitRequestBody
如果是,请将其更改为更大的数字,如果找不到,请在您的站点配置下添加以下内容
LimitRequestBody 1024000000
uwsgi --limit-post 1024000000
关于django - IOError:请求数据读取错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11287791/
我有一个 python 脚本,它创建一个 tar 文件,将文件移动到 tar 文件中,然后删除它们。 我可以毫无问题地手动运行脚本。但是当它从 cron 运行时,它失败了: IOError: [Err
我正在尝试从我的Python脚本打开文件recentlyUpdated.yaml。但当我尝试使用时:。我收到一个错误,内容是:。为什么?我怎样才能解决这个问题?
我正在尝试从我的Python脚本打开文件recentlyUpdated.yaml。但当我尝试使用时:。我收到一个错误,内容是:。为什么?我怎样才能解决这个问题?
我正在尝试从我的Python脚本打开文件recentlyUpdated.yaml。但当我尝试使用时:。我收到一个错误,内容是:。为什么?我怎样才能解决这个问题?
尝试将数据加载为 Excel 作为响应时,出现 IO 请求数据读取错误。 def convert_to_excel(request): field = forms.CharField()
我正在尝试读取文件夹树中的一系列 DICOM 文件,并且我使用下面的代码来运行树,边读取每个文件。问题是我收到确实存在的文件的 IOErrors,我已经检查了文件权限和其他 SO 线程,例如 Pyth
我有一个类可以读取特定格式的文件。这些文件的大小往往大于 8Gb,因此通常会进行压缩。在读取文件时,我想捕获文件未被压缩的错误,但 except IOError: 和 except: 都不会这样做,出
这个问题在这里已经有了答案: open() gives FileNotFoundError / IOError: '[Errno 2] No such file or directory' (8 个
给定这段代码: try: #do something except IOError as message: logging.error(message)
for subdir, dirs, files in os.walk(crawlFolder): for file in files: print os.getcwd()
我正在尝试导入模块并创建其类的对象,如下所示: >>> import scriptsim >>> scriptsim.Simulator() 但出现以下错误: Traceback (most rece
我正在使用以下第三方库在 Django 中编写网络应用程序: Django==1.6.1 argparse==1.2.1 cffi==0.8.1 pycparser==2.10 pylast==0.5
我正在使用 python-crontab module确保每天下午 2 点运行我的脚本。 但是我在执行脚本时遇到了一些 IOErrors Traceback: File "backup.py", li
我正在编写一个程序来更改我的桌面背景。它通过读取文本文件来完成此操作。如果文本文件显示其中一个 BG 文件名,它会将那个保存为我的背景,并将另一个的名称写入文件并关闭它。 我似乎无法让它工作。 这是我
我从未见过 IOError被抛出。文档中关于 IOError 的唯一内容是: Thrown when a serious I/O error has occurred. 没有任何子类或其他明显的东西。
我正在尝试下载链接并将其放置在downloads文件夹中,但是出现权限错误。我是计算机上的管理员用户,我也以管理员模式运行它。仍然我得到同样的错误。 这是我使用的代码: urllib.urlretri
我正在构建一个 Haskell 应用程序,并试图弄清楚如何构建错误处理机制。在实际的应用程序中,我正在使用 Mongo 进行大量工作。但是,为此,我将通过对文件进行基本 IO 操作来进行简化。 因此,
当我尝试重试失败的任务时,我会间歇性地(大约 20% 的时间)从 Celery 收到 IOError 异常。 这是我的任务: @task def update_data(pk_id): tr
我编写了一个 python 脚本,想要将日志写入/var/log/myapp.log 中的文件。然而,在某些平台上这并不存在,或者我们可能没有这样做的权限。既然如此,我想尝试在其他地方写。 def g
我已经使用 getopts 编写了一个脚本来接受四个用户输入项(两个输入文件和两个输出文件)。但由于某种原因,我不断收到此错误: python2.7 compare_files.py -b /tmp/
我是一名优秀的程序员,十分优秀!