Skip to content

TemplateConfig class

Reference for the TemplateConfig class object and how to use it.

Read more about how to use the TemplateConfig in your application and leverage the system.

How to import

from esmerald import TemplateConfig


Bases: BaseModel

An instance of TemplateConfig.

This configuration is a simple set of configurations that when passed enables the template engine.


You might need to install the template engine before using this. You can always run pip install esmerald[templates] to help you out.


from esmerald import Esmerald
from esmerald.config.template import TemplateConfig
from esmerald.template.jinja import JinjaTemplateEngine

template_config = TemplateConfig(

app = Esmerald(template_config=template_config)

engine class-attribute instance-attribute

engine = JinjaTemplateEngine

The template engine to be used.

directory instance-attribute


The directory for the templates in the format of a path like.

Example: /templates.