2017-11-17 19 views
0

私は約1ヶ月で触れていないdjangoプロジェクトを持っています。私はアプリケーションの任意のページ(管理者のログインページを含む)に接続しようとするとエラーが表示されるようにカムバックしています。エラーは次のとおりです。ValueError/admin/login/- 辞書更新シーケンス要素#0の長さは0です。 2が必要です

ValueError at/admin/login/ ディクショナリ更新シーケンス要素#0の長さは0です。 2は、ここで

を必要とする完全なトレースバックです:

import os 

# Build paths inside the project like this: os.path.join(BASE_DIR, ...) 
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 


# Quick-start development settings - unsuitable for production 
# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/ 

# SECURITY WARNING: keep the secret key used in production secret! 
SECRET_KEY = '***' 

# SECURITY WARNING: don't run with debug turned on in production! 
DEBUG = True 

LOGIN_URL = '/welcome' 
AUTHENTICATION_BACKENDS = ['ad_app.authentication.EmailBackend'] 

ALLOWED_HOSTS = [] 

# Application definition 

INSTALLED_APPS = [ 
    'ad_app.apps.AdAppConfig', 
    'django.contrib.admin', 
    'django.contrib.auth', 
    'django.contrib.contenttypes', 
    'django.contrib.sessions', 
    'django.contrib.messages', 
    'django.contrib.staticfiles', 
] 

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', 
] 

ROOT_URLCONF = 'ad_project.urls' 

TEMPLATES = [ 
    { 
     'BACKEND': 'django.template.backends.django.DjangoTemplates', 
     'DIRS': [], 
     'APP_DIRS': True, 
     'OPTIONS': { 
      'context_processors': [ 
       'django.template.context_processors.debug', 
       'django.template.context_processors.request', 
       'django.contrib.auth.context_processors.auth', 
       'django.contrib.messages.context_processors.messages', 
       'ad_app.views.wallet', 
      ], 
     }, 
    }, 
] 

WSGI_APPLICATION = 'ad_project.wsgi.application' 


# Database 
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases 

DATABASES = { 
    'default': { 
     'ENGINE': 'django.db.backends.sqlite3', 
     'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 
    } 
} 


# Password validation 
# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators 

AUTH_PASSWORD_VALIDATORS = [ 
    { 
     'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 
    }, 
    { 
     'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 
    }, 
    { 
     'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 
    }, 
    { 
     'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 
    }, 
] 

# Internationalization 
# https://docs.djangoproject.com/en/1.11/topics/i18n/ 

LANGUAGE_CODE = 'en-us' 

TIME_ZONE = 'UTC' 

USE_I18N = True 

USE_L10N = False 

USE_TZ = True 


# Static files (CSS, JavaScript, Images) 
# https://docs.djangoproject.com/en/1.11/howto/static-files/ 

STATIC_URL = '/static/' 

# TEMPLATE_DIRS = (os.path.join(BASE_DIR, 'templates'),) 

すべてのヘルプははるかに高く評価されるだろう、私はあればより多くの情報を提供することができます。ここでは

Environment: 


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

Django Version: 1.11.4 
Python Version: 3.6.2 
Installed Applications: 
['ad_app.apps.AdAppConfig', 
'django.contrib.admin', 
'django.contrib.auth', 
'django.contrib.contenttypes', 
'django.contrib.sessions', 
'django.contrib.messages', 
'django.contrib.staticfiles'] 
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'] 



Traceback: 

File "C:\Users\James\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\handlers\exception.py" in inner 
    41.    response = get_response(request) 

File "C:\Users\James\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\handlers\base.py" in _get_response 
    217.     response = self.process_exception_by_middleware(e, request) 

File "C:\Users\James\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\handlers\base.py" in _get_response 
    215.     response = response.render() 

File "C:\Users\James\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\template\response.py" in render 
    107.    self.content = self.rendered_content 

File "C:\Users\James\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\template\response.py" in rendered_content 
    84.   content = template.render(context, self._request) 

File "C:\Users\James\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\template\backends\django.py" in render 
    66.    return self.template.render(context) 

File "C:\Users\James\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\template\base.py" in render 
    205.     with context.bind_template(self): 

File "C:\Users\James\AppData\Local\Programs\Python\Python36-32\lib\contextlib.py" in __enter__ 
    81.    return next(self.gen) 

File "C:\Users\James\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\template\context.py" in bind_template 
    263.    updates.update(processor(self.request)) 

Exception Type: ValueError at /admin/login/ 
Exception Value: dictionary update sequence element #0 has length 0; 2 is required 

は私のsettings.pyファイルです必要!コンテキストプロセッサから

+1

'ad_app.views.wallet'のコードを表示してください。それは実際にコンテキストプロセッサですか? –

+0

あなたは絶対に正しいです!私はその行を削除し、それが働いた、私はそこに何をしていたかはよく分からない、ありがとう – jackharris959

答えて

0

削除線

'ad_app.views.wallet', 

。 Daniel Rosemanに感謝します!

関連する問題