Eray Erdin
Eray Erdin

Reputation: 3149

django-admin-tools Raises ImproperlyConfigured

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

Upvotes: 4

Views: 2317

Answers (1)

Andrea Corbellini
Andrea Corbellini

Reputation: 17751

You have added it to the list of context processors, you should have added it to the list of loaders instead:

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

See the documentation for DjangoTemplates for more information about each OPTION.

Upvotes: 8

Related Questions