This commit adds a module at django_jinja/jinja2.py that imports the Jinja2 template engine class from django_jinja/backend.py, in order to provide the import path django_jinja.jinja2.Jinja2. This is because Django uses the module's name as the template engine's default NAME, and "backend" is a poor default name for our template backend.
In thread #301, @m000 suggested a different strategy of renaming backend.py to jinja2.py, and adding a new backend.py as a shim to fix backwards compatibility, with a warning message promising it to break later. I avoided this approach because I don't want to break compatibility with existing projects at all, if I don't have to.
So at this time, I see no reason to plan the removal of support for the old import path. Instead, the examples in the docs now show the new path, and I added this explanation to the changelog:
Previously, when configuring TEMPLATES in Django's settings, NAME had to be set to avoid the template engine's name becoming "backend":
There are no plans to remove support for the old backend import path, for consideration of existing projects. Also, be careful if you've set NAME to "jinja" (not "jinja2")!
This commit adds a module at
django_jinja/jinja2.py
that imports theJinja2
template engine class fromdjango_jinja/backend.py
, in order to provide the import pathdjango_jinja.jinja2.Jinja2
. This is because Django uses the module's name as the template engine's defaultNAME
, and "backend" is a poor default name for our template backend.In thread #301, @m000 suggested a different strategy of renaming
backend.py
tojinja2.py
, and adding a newbackend.py
as a shim to fix backwards compatibility, with a warning message promising it to break later. I avoided this approach because I don't want to break compatibility with existing projects at all, if I don't have to.So at this time, I see no reason to plan the removal of support for the old import path. Instead, the examples in the docs now show the new path, and I added this explanation to the changelog:
Previously, when configuring
TEMPLATES
in Django's settings,NAME
had to be set to avoid the template engine's name becoming"backend"
:If your code matches that pattern, it can now be simplified to:
There are no plans to remove support for the old
backend
import path, for consideration of existing projects. Also, be careful if you've setNAME
to"jinja"
(not"jinja2"
)!