Opened 10 years ago

Last modified 10 years ago

#24389 closed Bug

CSRF error page requires DjangoTemplates backend — at Version 1

Reported by: Tzu-ping Chung Owned by: nobody
Component: Template system Version: 1.8alpha1
Severity: Release blocker Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Tzu-ping Chung)

When a CSRF error is raised in debug mode, the technical page require DjangoTemplates to be rendered. If you have your TEMPLATES setting configured without a DjangoTemplates entry, you will instead get an ImproperlyConfigured: No DjangoTemplates backend is configured. error. This can be resolved if you add a DjangoTemplates entry to the TEMPLATES setting, but since many error pages (500, 404, etc.) work without DjangoTemplates, this one probably should, too.

To reproduce:

  1. Create a new project.
  1. Change the TEMPLATES setting to not include a DjangoTemplates entry, e.g.
TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.jinja2.Jinja2',
        'DIRS': [],
        'APP_DIRS': True,
        'OPTIONS': {
        },
    },
]
  1. Create a view, and send a POST request to it in the browser, without the CSRF token.

Change History (1)

comment:1 by Tzu-ping Chung, 10 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top