我安装了django admin并收到object() takes no parameters
错误。我看到错误位于debug_toolbar panel.py
第55行。我不确定如何调试它。
我已经粘贴了追溯。
Environment:
Request Method: GET
Request URL: http://127.0.0.1:8000/super_admin/
Django Version: 1.6.1
Python Version: 2.7.4
Installed Applications:
('django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.humanize',
'debug_toolbar',
'django_extensions',
'apps.app1',
'apps.accounts',
'south')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'debug_toolbar.middleware.DebugToolbarMiddleware')
Traceback:
File "/home/home/environments/env1.6.2/local/lib/python2.7/site- packages/home/core/handlers/base.py" in get_response
139. response = response.render()
File "/home/home/environments/env1.6.2/local/lib/python2.7/site- packages/django/template/response.py" in render
105. self.content = self.rendered_content
File "/home/home/environments/env1.6.2/local/lib/python2.7/site-packages/django/template/response.py" in rendered_content
81. context = self.resolve_context(self.context_data)
File "/home/home/environments/env1.6.2/local/lib/python2.7/site-packages/django/template/response.py" in resolve_context
159. return RequestContext(self._request, context, current_app=self._current_app)
File "/home/home/environments/env1.6.2/local/lib/python2.7/site-packages/debug_toolbar/panels/templates/panel.py" in _request_context__init__
55. context = processor(request)`
Exception Type: TypeError at /super_admin/
Exception Value: object() takes no parameters
任何帮助都将受到高度赞赏。
修改
以下是我的TEMPLATE_CONTEXT_PROCESSORS
设置
TEMPLATE_CONTEXT_PROCESSORS = (
'django.contrib.auth.context_processors.auth',
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'django.core.context_processors.media',
'django.core.context_processors.request',
'django.core.context_processors.static',
'django.contrib.messages.context_processors.messages',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
)
答案 0 :(得分:3)
您的TEMPLATE_CONTEXT_PROCESSORS
设置中有两个条目是中间件,而不是上下文处理器。它们属于MIDDLEWARE_CLASSES
设置。