Graceful error when using Jinja2Templates, but jinja2 is not installed

This commit is contained in:
Tom Christie 2019-02-23 17:49:07 +00:00
parent 92dddea776
commit 9944bb7048
1 changed files with 1 additions and 0 deletions

View File

@ -49,6 +49,7 @@ class Jinja2Templates:
"""
def __init__(self, directory: str) -> None:
assert jinja2 is not None, "jinja2 must be installed to use Jinja2Templates"
self.env = self.get_env(directory)
def get_env(self, directory: str) -> "jinja2.Environment":