我们有一个基于 Django 的 Web 应用程序,用于从 iOS 设备接收 POST 数据(推送通知令牌)。
总而言之,该应用程序似乎运行良好,我们每小时都会收到 1000-2000 个带有有效数据的 POST。但是,我偶尔会收到来自 Django 的错误日志,其中包含以下数据:
Traceback (most recent call last):
File "/opt/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 111, in get_response
response = callback(request, *callback_args, **callback_kwargs)
File "/opt/local/lib/python2.7/site-packages/django/views/decorators/vary.py", line 19, in inner_func
response = func(*args, **kwargs)
File "/opt/local/lib/python2.7/site-packages/django_piston-0.2.3-py2.7.egg/piston/resource.py", line 160, in __call__
request.data = request.POST
File "/opt/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 180, in _get_post
self._load_post_and_files()
File "/opt/local/lib/python2.7/site-packages/django/http/__init__.py", line 372, in _load_post_and_files
self._post, self._files = QueryDict(self.body, encoding=self._encoding), MultiValueDict()
File "/opt/local/lib/python2.7/site-packages/django/http/__init__.py", line 328, in body
self._body = self.read()
File "/opt/local/lib/python2.7/site-packages/django/http/__init__.py", line 384, in read
return self._stream.read(*args, **kwargs)
File "/opt/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 98, in read
result = self.buffer + self._read_limited()
File "/opt/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 92, in _read_limited
result = self.stream.read(size)
UnreadablePostError: request data read error
WSGIRequest 转储说POST: <could not parse>
我一直在尝试查找有关此错误的更多信息,并且我所看到的很多内容都表明此错误是由用户在帖子完成之前取消 POST 请求引起的。这是我应该关注的错误,还是应该只设置服务器以过滤掉这些错误消息?我会说我每天可能会收到 8 到 10 封关于此的自动电子邮件。