当我运行服务器时python3 manage.py runserver
浏览器返回A server error occurred. Please contact the administrator.
然后我得到这个错误`Traceback (most recent call last):
File "/usr/lib/python3.5/wsgiref/handlers.py", line 137, in run
self.result = application(self.environ, self.start_response)
File "/usr/local/lib/python3.5/dist-packages/django/contrib/staticfiles/handlers.py", line 63, in __call__
return self.application(environ, start_response)
File "/usr/local/lib/python3.5/dist-packages/django/core/handlers/wsgi.py", line 170, in __call__
self.load_middleware()
File "/usr/local/lib/python3.5/dist-packages/django/core/handlers/base.py", line 52, in load_middleware
mw_instance = mw_class()
TypeError: __init__() missing 1 required positional argument: 'get_response'
我的设置文件是这样的
^{pr2}$
在五月我创建了一个项目中间件.py而且看起来像这样from django.conf import settings
class LoginRequiredMiddleware:
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
response = self.get_response(request)
return response
有什么好主意?!在