From bf519478cbc6e296785241cd7d01edb23c317cd3 Mon Sep 17 00:00:00 2001 From: Miguel Grinberg Date: Sun, 14 Jan 2024 12:47:14 +0000 Subject: [PATCH] Added documentation on using alternative utemplate loaders --- docs/extensions.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/extensions.rst b/docs/extensions.rst index 86086db..db02b66 100644 --- a/docs/extensions.rst +++ b/docs/extensions.rst @@ -134,6 +134,21 @@ method:: Template.initialize('my_templates') +By default templates are automatically compiled the first time they are +rendered, or when their last modified timestamp is more recent than the +compiledo file's timestamp. This loading behavior can be changed by switching +to a different template loader. For example, if the templates are pre-compiled, +the timestamp check and compile steps can be removed by switching to the +"compiled" template loader:: + + from utemplate import compiled + from microdot.utemplate import Template + + Template.initialize(loader_class=compiled.Loader) + +Consult the `uTemplate documentation `_ +for additional information regarding template loaders. + Using the Jinja Engine ^^^^^^^^^^^^^^^^^^^^^^