Opened 9 years ago

Last modified 9 years ago

#24922 closed Bug

Templates: conflicting settings should emit a system check error — at Initial Version

Reported by: Sergei Maertens Owned by: nobody
Component: Core (System checks) Version: dev
Severity: Normal Keywords: templates, system check
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

I discovered that specifying the templates settings as following, raises an error when rendering the template:

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

Error:

Traceback (most recent call last):
  File "/home/modelbrouw/.virtualenvs/staging/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 189, in __call__
    response = self.get_response(request)
  File "/home/modelbrouw/.virtualenvs/staging/lib/python2.7/site-packages/django/core/handlers/base.py", line 218, in get_response
    response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
  File "/home/modelbrouw/.virtualenvs/staging/lib/python2.7/site-packages/django/core/handlers/base.py", line 268, in handle_uncaught_exception
    return callback(request, **param_dict)
  File "/home/modelbrouw/.virtualenvs/staging/lib/python2.7/site-packages/django/utils/decorators.py", line 110, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "/home/modelbrouw/.virtualenvs/staging/lib/python2.7/site-packages/django/views/defaults.py", line 42, in server_error
    template = loader.get_template(template_name)
  File "/home/modelbrouw/.virtualenvs/staging/lib/python2.7/site-packages/django/template/loader.py", line 29, in get_template
    engines = _engine_list(using)
  File "/home/modelbrouw/.virtualenvs/staging/lib/python2.7/site-packages/django/template/loader.py", line 144, in _engine_list
    return engines.all() if using is None else [engines[using]]
  File "/home/modelbrouw/.virtualenvs/staging/lib/python2.7/site-packages/django/template/utils.py", line 110, in all
    return [self[alias] for alias in self]
  File "/home/modelbrouw/.virtualenvs/staging/lib/python2.7/site-packages/django/template/utils.py", line 101, in __getitem__
    engine = engine_cls(params)
  File "/home/modelbrouw/.virtualenvs/staging/lib/python2.7/site-packages/django/template/backends/django.py", line 24, in __init__
    self.engine = Engine(self.dirs, self.app_dirs, **options)
  File "/home/modelbrouw/.virtualenvs/staging/lib/python2.7/site-packages/django/template/engine.py", line 36, in __init__
    "app_dirs must not be set when loaders is defined.")
django.core.exceptions.ImproperlyConfigured: app_dirs must not be set when loaders is defined.

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top