我使用的是测试服务器时,它给了我下面的异常从阅读本回溯测试Django项目AttributeError的:“搜索”对象在Django项目没有属性“STATUS_CODE”
Traceback (most recent call last):
File "/usr/lib/pymodules/python2.6/django/core/servers/basehttp.py", line 280, in run self.result = application(self.environ, self.start_response)
File "/usr/lib/pymodules/python2.6/django/core/servers/basehttp.py", line 674, in >call return self.application(environ, start_response)
File "/usr/lib/pymodules/python2.6/django/core/handlers/wsgi.py", line 245, in call response = middleware_method(request, response)
File "/usr/lib/pymodules/python2.6/django/middleware/common.py", line 84, in >process_response if response.status_code == 404:
AttributeError: 'search' object has no attribute 'status_code'
只是,我不要认为问题出在我的代码中,但我不确定。有人可以看看我的代码并帮我解决这个问题吗?我的代码托管在GitHub和任何其他意见或建议,非常感谢。预先感谢您的时间和考虑。
musicgrep/views.py第13行? – Jerzyk 2011-04-03 21:51:18
同样的文件'搜索'它会返回什么?肯定不是一个HttpResponse实例 - 而这正是你的问题的来源 – Jerzyk 2011-04-03 21:52:28
然后,使用'.gitignore'阅读pep8 http://www.python.org/dev/peps/pep-0008/ – Jerzyk 2011-04-03 21:53:08