python - Does the Jinja2 templating language have the concept of 'here' (current directory)? -


Does the support template for Jinna 2 support the relative path e.g. % (here) s / other / template.html ,

to include other templates relative to the location of the current template in the file system "Post -text" itemprop = "text">

I do not believe this. Typically, the template loaders and the environment you are using, add or add other templates by specifying your path based on their root.

Then we say that your template is set to all / path / to / templates and you have set Jija to:

  Import jinja2 Template_dir = '/ path / to / templates' loader = jinja2.FileSystemLoader (template_dir) environment = jinja2.Environment (loader = loader)  

Now, if you enter / path / to You want to include / templates / include / sidebar.html in the / path /to/templates/index.html template, in your index.html The following will write:

  {% include / include / sidebar .html '%}  

and Jinja will find out how The Undna.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -