Skip to content Skip to sidebar Skip to footer

After Installing Jinja2 Templatedoesnotexist At /admin/

I have installed jinja2 and after that 'DIRS' stopped working(I have to include them by hand). Changing 'APP_DIRS' doesn`t help templates look like that: TEMPLATES = [ { 'BACK

Solution 1:

The Django admin app does not come with Jinja templates. If you wish to use Jinja and the admin app, you need to include both engines in your TEMPLATES setting:

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [],
        'APP_DIRS': True,  # This allows Django to find the templates in the admin app'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',
            ],
        },
    },
    {
        'BACKEND': 'django.template.backends.jinja2.Jinja2',
        # The rest of your Jinja2 settings.
    },

Secondly, when APP_DIRS is True, the Jinja2 backend looks for templates in a jinja2 subdirectory. That means you should put your templates in main/jinja2 and shop/jinja2 instead of main/templates and shop/templates.

Post a Comment for "After Installing Jinja2 Templatedoesnotexist At /admin/"