2

I installed and configured as told in quickstart guide of django-admin-tools. Those are settings.py lines:

# INSTALLED APPS
'admin_tools',
'admin_tools.theming',
'admin_tools.menu',
'admin_tools.dashboard',
'django.contrib.sites',

And I also included admin_tools.template_loaders.Loader into TEMPLATES variable as told in guide as below:

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',
                'admin_tools.template_loaders.Loader',
            ],
        },
    },
]

However, it still raises ImproperlyConfigured exception as below:

django.core.exceptions.ImproperlyConfigured: You must add the "admin_tools.template_loaders.Loader" template loader to your TEMPLATES settings variable

I did not understand.

Environment

  • python 3.4.x
  • django 1.8.7
4

1 に答える 1

6

コンテキスト プロセッサのリストに追加しましたが、代わりにローダーのリストに追加する必要があります。

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',
            ],
            'loaders': [
                'django.template.loaders.filesystem.Loader',
                'django.template.loaders.app_directories.Loader',
                'admin_tools.template_loaders.Loader',
            ],
        },
    },
]

各 の詳細については、ドキュメントをDjangoTemplates参照してくださいOPTION

于 2016-01-10T16:40:04.280 に答える