Question

I'm integrating jinja2 to pylons, I see in the document page there is:

from jinja2 import Environment, PackageLoader
config['pylons.app_globals'].jinja_env = Environment(
    loader=PackageLoader('yourapplication', 'templates')
)

My question is: what should I use for yourapplication? Suppose my application is 'test', what should I write as yourapplication?

Was it helpful?

Solution

if would guess that you should use 'test' as well, like this:

config['pylons.app_globals'].jinja_env = Environment(
    loader=PackageLoader('test', 'templates')
)

in general 'yourapplication' should match the name of your main applicaton package i.e. the one that contains 'config', 'controllers', 'lib' and so on)

hint: if you start on a fresh project you will be prompted for the template engine during setup, so just enter jinja2 to replace mako as default templating language and everything will be configured automatically

paster create -t pylons myapp
...
Enter template_engine (mako/genshi/jinja2/etc: Template language) ['mako']:
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top