Last active
April 25, 2018 18:22
-
-
Save kkirsche/b0d79e8cc4b23a9b0ef819e7e0682a09 to your computer and use it in GitHub Desktop.
Jinja Environments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from jinja2 import Environment, FileSystemLoader, select_autoescape | |
jinja_env = Environment(loader=FileSystemLoader('/path/to/templates', followlinks=True), autoescape=select_autoescape([])) | |
tmpl = jinja_env.get_template('template_name') | |
view = tmpl.render(values=values) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from jinja2 import Environment, PackageLoader, select_autoescape | |
jinja_env = Environment(loader=PackageLoader('package_name', 'dir'), autoescape=select_autoescape([])) | |
tmpl = jinja_env.get_template('template_name') | |
view = tmpl.render(values=values) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment