jinja2.FileSystemLoader

class jinja2.FileSystemLoader(searchpath, encoding='utf-8', followlinks=False)[source]

Loads templates from the file system. This loader can find templates in folders on the file system and is the preferred way to load them.

The loader takes the path to the templates as string, or if multiple locations are wanted a list of them which is then looked up in the given order:

>>> loader = FileSystemLoader('/path/to/templates')
>>> loader = FileSystemLoader(['/path/to/templates', '/other/path'])

Per default the template encoding is 'utf-8' which can be changed by setting the encoding parameter to something else.

To follow symbolic links, set the followlinks parameter to True:

>>> loader = FileSystemLoader('/path/to/templates', followlinks=True)

Changed in version 2.8+: The followlinks parameter was added.

Methods

__init__(searchpath[, encoding, followlinks])
get_source(environment, template)
list_templates()
load(environment, name[, globals]) Loads a template.

Attributes

has_source_access