Задать вопрос

Тел: +7 965 3737 888





Django 1.2+ template loader for Jinja2

<p>This is a minimal template loader for Django 1.2 or higher that loads <a href="http://jinja.pocoo.org/2/">Jinja2</a> templates.  It is better integrated with Django than using Jinja2 directly:</p>
<ul><li>Your view code is the same</li>
<li>Unmodified generic views use it</li>
<li>RequestContext and context processors still work</li>
</ul><p>To use it, add the following to you settings.py file:</p>

<p>It searches for templates in the same places as django.template.loaders.app_directories.Loader &#8722; that is in the templates directory of each installed app.</p>
<p>Django custom and default template tags and filters are not available.  Some are the same in Jinja2, but you need to replace the others yourself.  You can add global filters and variables (such as functions) in the Loader.env.filters and Loader.env.globals dicts.  You can not add tags.  See the <a href="http://jinja.pocoo.org/2/documentation/">Jinja2 documentation</a> for more details.</p>

Вопрос полезен? Да0/Нет0

Ответы (1):

Ответ полезен? Да0/Нет0

Your setup may be different than mine, but I think you want to add settings.TEMPLATE_DIRS to app_template_dirs on line 29. Otherwise it seems that it will only load templates from the django module directories but not from your app.

This is excellent, by the way. It was a huge help.