2017-08-26 40 views
0

我使用的Django創建待辦事項應用程序,但同時重定向到http://127.0.0.1:8000/admin/我得到錯誤無法存取權限管理面板在Django

「模塊」對象有沒有屬性「的GetItem

Request Method: GET 
Request URL: http://127.0.0.1:8000/admin/login/?next=/admin/ 

Django Version: 1.11.2 
Python Version: 2.7.12 
Installed Applications: 
['django.contrib.admin', 
'django.contrib.auth', 
'django.contrib.contenttypes', 
'django.contrib.sessions', 
'django.contrib.messages', 
'django.contrib.staticfiles', 
'todolist.apps.TodolistConfig'] 
Installed Middleware: 
['django.middleware.security.SecurityMiddleware', 
'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'] 


Exception Type: TypeError at /admin/login/ 
Exception Value: 'module' object has no attribute '__getitem__' 

我收到回溯是:

File "/home/knight/.local/lib/python2.7/site-packages/django/core/handlers/exception.py" in inner 
    41.    response = get_response(request) 

File "/home/knight/.local/lib/python2.7/site-packages/django/core/handlers/base.py" in _get_response 
    187.     response = self.process_exception_by_middleware(e, request) 

File "/home/knight/.local/lib/python2.7/site-packages/django/core/handlers/base.py" in _get_response 
    185.     response = wrapped_callback(request, *callback_args, **callback_kwargs) 

File "/home/knight/.local/lib/python2.7/site-packages/django/views/decorators/cache.py" in _wrapped_view_func 
    57.   response = view_func(request, *args, **kwargs) 

File "/home/knight/.local/lib/python2.7/site-packages/django/contrib/admin/sites.py" in login 
    393.   return LoginView.as_view(**defaults)(request) 

File "/home/knight/.local/lib/python2.7/site-packages/django/views/generic/base.py" in view 
    68.    return self.dispatch(request, *args, **kwargs) 

File "/home/knight/.local/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapper 
    67.    return bound_func(*args, **kwargs) 

File "/home/knight/.local/lib/python2.7/site-packages/django/views/decorators/debug.py" in sensitive_post_parameters_wrapper 
    76.    return view(request, *args, **kwargs) 

File "/home/knight/.local/lib/python2.7/site-packages/django/utils/decorators.py" in bound_func 
    63.     return func.__get__(self, type(self))(*args2, **kwargs2) 

File "/home/knight/.local/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapper 
    67.    return bound_func(*args, **kwargs) 

File "/home/knight/.local/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapped_view 
    149.      response = view_func(request, *args, **kwargs) 

File "/home/knight/.local/lib/python2.7/site-packages/django/utils/decorators.py" in bound_func 
    63.     return func.__get__(self, type(self))(*args2, **kwargs2) 

File "/home/knight/.local/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapper 
    67.    return bound_func(*args, **kwargs) 

File "/home/knight/.local/lib/python2.7/site-packages/django/views/decorators/cache.py" in _wrapped_view_func 
    57.   response = view_func(request, *args, **kwargs) 

File "/home/knight/.local/lib/python2.7/site-packages/django/utils/decorators.py" in bound_func 
    63.     return func.__get__(self, type(self))(*args2, **kwargs2) 

File "/home/knight/.local/lib/python2.7/site-packages/django/contrib/auth/views.py" in dispatch 
    90.   return super(LoginView, self).dispatch(request, *args, **kwargs) 

File "/home/knight/.local/lib/python2.7/site-packages/django/views/generic/base.py" in dispatch 
    88.   return handler(request, *args, **kwargs) 

File "/home/knight/.local/lib/python2.7/site-packages/django/views/generic/edit.py" in get 
    174.   return self.render_to_response(self.get_context_data()) 

File "/home/knight/.local/lib/python2.7/site-packages/django/contrib/auth/views.py" in get_context_data 
    121.   context = super(LoginView, self).get_context_data(**kwargs) 

File "/home/knight/.local/lib/python2.7/site-packages/django/views/generic/edit.py" in get_context_data 
    93.    kwargs['form'] = self.get_form() 

File "/home/knight/.local/lib/python2.7/site-packages/django/views/generic/edit.py" in get_form 
    45.   return form_class(**self.get_form_kwargs()) 

File "/home/knight/.local/lib/python2.7/site-packages/django/contrib/auth/forms.py" in __init__ 
    179.   if self.fields['username'].label is None: 
+1

這似乎並不是完整的錯誤追溯。請從您的終端複製錯誤追蹤並將其張貼在這裏 –

+0

你會幫忙嗎? –

+0

訪問代碼中的某些字典對象時出現問題。你確定你發佈了所有的錯誤跟蹤嗎? –

回答

0

它完成了!只是改變了一些功能,並將django 1.11.2更新爲1.11.4,現在效果很好!