python - AttributeError: 'search' 对象在 Django 项目中没有属性 'status_code'

标签 python django attributeerror

我正在使用测试服务器测试一个 django 项目,当它给我以下异常时

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/musicgrep/views.py 没有返回 HttpResponse 实例

关于python - AttributeError: 'search' 对象在 Django 项目中没有属性 'status_code',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5532546/

相关文章:

python - 如何在pandas中分组后从每组中选择前n行?

python - 是否可以在 python (2.4) 中制作这种装饰器?

python - 在 pandas/python 中嵌套带有 .loc 的 if 语句

python - 无法使用 __exit__ 方法创建mockito模拟

python - Pandas:用从特定索引开始的系列填充数据框列

python - Django 查询中 or-ing Q 对象的性能影响

python - django admin 在尝试更新记录时崩溃但在插入新记录时不崩溃

Django JSONField,并使用ILIKE搜索字典列表

python - 不明白为什么在 VS Code 中调试脚本会导致 AttributeError

Python:Pandas Dataframe AttributeError: 'numpy.ndarray' 对象没有属性 'fillna'