摆脱Django IOErrors [英] Getting rid of Django IOErrors

查看:121
本文介绍了摆脱Django IOErrors的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行一个Django站点(通过Apache / mod_python),我使用Django的工具通知我和其他开发人员内部的服务器错误。有时会出现这样的错误:

 追溯(最近的最后一次呼叫):

文件/ opt /webapp/externals/lib/django/core/handlers/base.py,第92行,get_response
response = callback(request,* callback_args,** callback_kwargs)

文件 /opt/webapp/csite/apps/customers/views.py,第29行,反馈
form = FeedbackForm(request.POST)

文件/ opt / webapp / externals / lib / django / core / handlers / modpython.py,第113行,在_get_post
self._load_post_and_files()

文件/ opt / webapp / externals / lib / django / core /处理程序/ modpython.py,第96行,在_load_post_and_files
self._post,self._files = http.QueryDict(self.raw_post_data,encoding = self._encoding),datastructures.MultiValueDict()

文件/opt/webapp/externals/lib/django/core/handlers/modpython.py,第163行,在_get_raw_post_data
self._raw_post_data = self._req.read()

IOError:客户端读取错误(超时?)

据我所知,这些 IOError 是由客户端生成的断开错误的时刻,这不是我的网站的问题。



如果是这样的情况:我可以禁用这些错误的电子邮件吗?我真的不想知道我无法解决的错误,这不是真的错误。

解决方案

你应该能够编写一个中间件来捕获异常,然后可以沉默这些特定的异常。



http://docs.djangoproject.com/en/1.1/topics/http/middleware/#process-exception


I'm running a Django site (via Apache/mod_python) and I use Django's facilities to inform me and other developers about internal server errors. Sometimes errors like those appear:

Traceback (most recent call last):

  File "/opt/webapp/externals/lib/django/core/handlers/base.py", line 92, in get_response
    response = callback(request, *callback_args, **callback_kwargs)

  File "/opt/webapp/csite/apps/customers/views.py", line 29, in feedback
    form = FeedbackForm(request.POST)

  File "/opt/webapp/externals/lib/django/core/handlers/modpython.py", line 113, in _get_post
    self._load_post_and_files()

  File "/opt/webapp/externals/lib/django/core/handlers/modpython.py", line 96, in _load_post_and_files
    self._post, self._files = http.QueryDict(self.raw_post_data, encoding=self._encoding), datastructures.MultiValueDict()

  File "/opt/webapp/externals/lib/django/core/handlers/modpython.py", line 163, in _get_raw_post_data
    self._raw_post_data = self._req.read()

IOError: Client read error (Timeout?)

As far as I found out, those IOErrors are generated by clients that disconnect in the wrong moment and that it's not a problem of my site.

If that is the case: Can I disable the emails for those errors somehow? I really don't want to know about errors that I cannot fix and that aren't really errors.

解决方案

You should be able to write a Middleware to catch the exception and you can then "silence" those specific exceptions.

http://docs.djangoproject.com/en/1.1/topics/http/middleware/#process-exception

这篇关于摆脱Django IOErrors的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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