Open haukuri opened 3 months ago
Yes, this would be an addition. I only use app template dirs, so never built for this.
Happy to take a patch adding a fallback with tests.
I just tested this for a project-level template, and it worked great.
I did not test it for an app-level template.
When trying to generate templates with the
mktemplate
management command in a project with a project-level template directory, the command blows up when trying to access thetemplate_dirs
attribute on an instance ofdjango.template.engine.Engine
.I went digging around and found that
template_dirs
is an attribute ofdjango.template.backends.base.BaseEngine
.I can only assume that there are some cases in which
Engine.get_default()
returns a subclass ofBaseEngine
instead of an instance ofEngine
.I have a test project in a fork of Neapolitan that can be used to reproduce the error with
I also have a branch in which I patched the
mktemplate
handle
method to use thedirs
property onEngine
instead of thetemplate_dirs
property onBaseEngine
if the latter is not present on the default engine. I'm not sure if that is always the correct behavior but it works on my machine (tm).