iso
4/22/2016 - 6:47 AM

how to use jinja with file input as template

how to use jinja with file input as template

Code snippet for how to use jinja2 with file as an input for template.

from jinja2 import Environment,FileSystemLoader

env = Environment(loader=FileSystemLoader('files'))
template = env.get_template('somefilename.sh.j2')
output = template.render(name='elmo')
print output