jinja#
- class starlite.contrib.jinja.JinjaTemplateEngine#
Bases:
TemplateEngineProtocol[JinjaTemplate]The engine instance.
- __init__(directory: Union[DirectoryPath, List[DirectoryPath]]) None#
Jinja2 based TemplateEngine.
- Parameters:
directory – Direct path or list of directory paths from which to serve templates.
- get_template(template_name: str) JinjaTemplate#
Retrieve a template by matching its name (dotted path) with files in the directory or directories provided. :param template_name: A dotted path
- Returns:
JinjaTemplate instance
- Raises:
TemplateNotFoundException <starlite.exceptions.TemplateNotFoundException> – if no template is found.