diff --git a/starlette/templating.py b/starlette/templating.py index 5595364b..488d8c65 100644 --- a/starlette/templating.py +++ b/starlette/templating.py @@ -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":