template.loaders.locmem.Loader

class locmem.Loader

Loads templates from a Python dictionary. This is useful for testing.

This loader takes a dictionary of templates as its first argument:

TEMPLATES = [{
    'BACKEND': 'django.template.backends.django.DjangoTemplates',
    'OPTIONS': {
        'loaders': [
            ('django.template.loaders.locmem.Loader', {
                'index.html': 'content here',
            }),
        ],
    },
}]

This loader is disabled by default.

Django uses the template loaders in order according to the 'loaders' option. It uses each loader until a loader finds a match.

doc_Django
2016-10-09 18:39:51
Comments
Leave a Comment

Please login to continue.