Django错误TypeError:' NoneType'对象不可调用

时间:2018-03-19 17:02:57

标签: django

我在服务器上遇到此错误。你知道为什么会这样吗? 我有一个django网站,并且不知道为什么这个错误出现在终端中。你的意见很有价值!

[19/Mar/2018 18:27:45] "GET /posts/%20/static/css/navbar-top.css HTTP/1.1" 404 107
Traceback (most recent call last):
  File "/usr/lib/python3.4/wsgiref/handlers.py", line 137, in run
    self.result = application(self.environ, self.start_response)
  File "/usr/local/lib/python3.4/dist-packages/django/contrib/staticfiles/handlers.py", line 67, in __call__
    return super().__call__(environ, start_response)
  File "/usr/local/lib/python3.4/dist-packages/django/core/handlers/wsgi.py", line 146, in __call__
    response = self.get_response(request)
  File "/usr/local/lib/python3.4/dist-packages/django/contrib/staticfiles/handlers.py", line 62, in get_response
    return super().get_response(request)
  File "/usr/local/lib/python3.4/dist-packages/django/core/handlers/base.py", line 81, in get_response
    response = self._middleware_chain(request)
TypeError: 'NoneType' object is not callable

1 个答案:

答案 0 :(得分:1)

正如评论中所提到的,代码可以帮助人们提出解决方案。

一般来说,当我看到'Nonetype'不可调用时,我通常将数据成员视为一个函数,即

request.method() 

什么时候应该是

request.method

反之亦然。

其他答案可以在stackoverflow上找到:

TypeError: NoneType object is not callable