#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:
> 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'
>
> }}}
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>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/0107018ada310141-99c4487c-eba1-4a2c-88a1-5db867afe01b-000000%40eu-central-1.amazonses.com.