[Django] #34878: Setting FORM_RENDERER="django.forms.renderers.TemplatesSetting" causes template autoreload to crash

2 views
Skip to first unread message

Django

unread,
Sep 28, 2023, 1:06:12 AM9/28/23
to django-...@googlegroups.com
#34878: Setting FORM_RENDERER="django.forms.renderers.TemplatesSetting" causes
template autoreload to crash
-------------------------------------------+------------------------
Reporter: danjac | Owner: nobody
Type: Uncategorized | Status: new
Component: Template system | Version: 5.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------------+------------------------
Running **Python 3.11** and **Django 5.0a1**.

I have the following settings:

{{{#!python

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'

}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/34878>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Sep 28, 2023, 1:09:23 AM9/28/23
to django-...@googlegroups.com
#34878: Setting FORM_RENDERER="django.forms.renderers.TemplatesSetting" causes
template autoreload to crash
---------------------------------+--------------------------------------

Reporter: danjac | Owner: nobody
Type: Uncategorized | Status: new
Component: Template system | Version: 5.0
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Description changed by danjac:

Old description:

New description:

Running **Python 3.11** and **Django 5.0a1**.

I have the following settings:

{{{#!python

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 (i.e. ''manage.py runserver'') 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'

}}}

--

--
Ticket URL: <https://code.djangoproject.com/ticket/34878#comment:1>

Reply all
Reply to author
Forward
0 new messages