Opened 9 months ago

Last modified 9 months ago

#34878 closed Bug

Setting FORM_RENDERER="django.forms.renderers.TemplatesSetting" causes template autoreload to crash — at Initial Version

Reported by: danjac Owned by: nobody
Component: Template system Version: 5.0
Severity: Release blocker Keywords:
Cc: Priyank Panchal, Jannis Vajen Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

Running Python 3.11 and Django 5.0a1.

I have the following settings:

DEBUG = True

FORM_RENDERER = "django.forms.renderers.TemplatesSetting"

TEMPLATES = [
    {
        "BACKEND": "django.template.backends.django.DjangoTemplates",
        "DIRS": [BASE_DIR / "templates"],
        "OPTIONS": {
            "debug": True,
            "context_processors": [
                "django.template.context_processors.debug",
                "django.template.context_processors.request",
                "django.contrib.auth.context_processors.auth",
                "django.template.context_processors.i18n",
                "django.template.context_processors.media",
                "django.template.context_processors.static",
                "django.template.context_processors.tz",
                "django.contrib.messages.context_processors.messages",
            ],
        },
    }
]

This causes the development server to crash whenever a template is saved:

  File "python-path/lib/python3.11/site-packages/django/template/autoreload.py", line 60, in template_changed
    reset_loaders()
  File "python-path/lib/python3.11/site-packages/django/template/autoreload.py", line 42, in reset_loaders
    backend = get_default_renderer().engine
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'TemplatesSetting' object has no attribute 'engine'

Change History (0)

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