开发者

Multiple Django template loaders

I'd like to use Jinja2 with a Django project. I'm using this template loader from Django Snippets, but I still need to be able to render templates with Django for the admin pages. Whenever I try to use the admin pages, though, I get a TemplateSyntaxError because of the unknown tag "l开发者_开发知识库oad". Is there a way to make the Jinja template loader defer to Django's built-in system when it can't handle the template?


I would recommend using this fork of Coffin when using Jinja and Django templates at the same time: https://github.com/GaretJax/coffin/blame/master/README.rst I implemented this on http://umbel.com/ which uses a combination of Django and Jinja templates.

It has a setting that you can use to disable Jinja's template loader for specific apps:

JINJA2_DISABLED_APPS = (
    'admin',
    'auth',
)

Hope that helps you out.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜