我正在運行一個Django站點(通過Apache/mod_python),我使用Django的工具來通知我和其他開發人員關於內部服務器錯誤。有時候,像那些出現錯誤:擺脫Django IO錯誤
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?)
至於我發現,是由在錯誤的時刻斷開客戶機生成的IOError
S和這不是我的網站的問題。
如果是這樣的話:我可以以某種方式禁用這些錯誤的電子郵件嗎?我真的不想知道我無法修復的錯誤,這並非真正的錯誤。
這將適用於視圖函數內發生的IOErrors。你可以爲視圖函數外的IOErrors做什麼?例如當將響應流送回客戶端時,例如返回HttpResponse(open('large_text_file.txt')) – Eloff 2011-10-13 21:46:57
用更新的django文檔鏈接更新這篇文章。 https://docs.djangoproject.com/en/1.10/topics/http/middleware/#process-exception – lyncas 2016-12-30 21:29:23