Unverified Commit 2808bad0 by John Eskew Committed by GitHub

Merge pull request #16416 from edx/jeskew/edxmako_startup_py_remove

Move edxmako startup to AppConfig::ready.
parents 01f6d692 ba07dec4
...@@ -966,7 +966,7 @@ INSTALLED_APPS = [ ...@@ -966,7 +966,7 @@ INSTALLED_APPS = [
'openedx.core.djangoapps.datadog', 'openedx.core.djangoapps.datadog',
# For asset pipelining # For asset pipelining
'edxmako', 'edxmako.apps.EdxMakoConfig',
'pipeline', 'pipeline',
'static_replace', 'static_replace',
'require', 'require',
......
"""
Initialize the mako template lookup
"""
from django.conf import settings
from django.apps import AppConfig
from django.conf import settings
from . import add_lookup, clear_lookups from . import add_lookup, clear_lookups
def run(): class EdxMakoConfig(AppConfig):
""" name = 'edxmako'
Setup mako lookup directories. verbose_name = "edX Mako Templating"
def ready(self):
"""
Setup mako lookup directories.
IMPORTANT: This method can be called multiple times during application startup. Any changes to this method 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. must be safe for multiple callers during startup phase.
""" """
template_locations = settings.MAKO_TEMPLATES template_locations = settings.MAKO_TEMPLATES
for namespace, directories in template_locations.items(): for namespace, directories in template_locations.items():
clear_lookups(namespace) clear_lookups(namespace)
for directory in directories: for directory in directories:
add_lookup(namespace, directory) add_lookup(namespace, directory)
...@@ -2040,7 +2040,7 @@ INSTALLED_APPS = [ ...@@ -2040,7 +2040,7 @@ INSTALLED_APPS = [
'status', 'status',
# For asset pipelining # For asset pipelining
'edxmako', 'edxmako.apps.EdxMakoConfig',
'pipeline', 'pipeline',
'static_replace', 'static_replace',
'webpack_loader', 'webpack_loader',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment