startup.py 580 Bytes
Newer Older
1 2 3 4
"""
Initialize the mako template lookup
"""
from django.conf import settings
5
from . import add_lookup, clear_lookups
6 7 8


def run():
9 10
    """
    Setup mako lookup directories.
11 12 13

    IMPORTANT: This method can be called multiple times during application startup. Any changes to this method
    must be safe for multiple callers during startup phase.
14
    """
15
    template_locations = settings.MAKO_TEMPLATES
16
    for namespace, directories in template_locations.items():
17
        clear_lookups(namespace)
18 19
        for directory in directories:
            add_lookup(namespace, directory)