mirror of https://github.com/encode/starlette.git
Graceful error when using Jinja2Templates, but jinja2 is not installed
This commit is contained in:
parent
92dddea776
commit
9944bb7048
|
@ -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":
|
||||
|
|
Loading…
Reference in New Issue