Move edxmako startup to AppConfig::ready.
This commit is contained in:
@@ -965,7 +965,7 @@ INSTALLED_APPS = [
|
||||
'openedx.core.djangoapps.datadog',
|
||||
|
||||
# For asset pipelining
|
||||
'edxmako',
|
||||
'edxmako.apps.EdxMakoConfig',
|
||||
'pipeline',
|
||||
'static_replace',
|
||||
'require',
|
||||
|
||||
22
common/djangoapps/edxmako/apps.py
Normal file
22
common/djangoapps/edxmako/apps.py
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
from django.apps import AppConfig
|
||||
from django.conf import settings
|
||||
from . import add_lookup, clear_lookups
|
||||
|
||||
|
||||
class EdxMakoConfig(AppConfig):
|
||||
name = 'edxmako'
|
||||
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
|
||||
must be safe for multiple callers during startup phase.
|
||||
"""
|
||||
template_locations = settings.MAKO_TEMPLATES
|
||||
for namespace, directories in template_locations.items():
|
||||
clear_lookups(namespace)
|
||||
for directory in directories:
|
||||
add_lookup(namespace, directory)
|
||||
@@ -1,20 +0,0 @@
|
||||
"""
|
||||
Initialize the mako template lookup
|
||||
"""
|
||||
from django.conf import settings
|
||||
|
||||
from . import add_lookup, clear_lookups
|
||||
|
||||
|
||||
def run():
|
||||
"""
|
||||
Setup mako lookup directories.
|
||||
|
||||
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.
|
||||
"""
|
||||
template_locations = settings.MAKO_TEMPLATES
|
||||
for namespace, directories in template_locations.items():
|
||||
clear_lookups(namespace)
|
||||
for directory in directories:
|
||||
add_lookup(namespace, directory)
|
||||
@@ -2039,7 +2039,7 @@ INSTALLED_APPS = [
|
||||
'status',
|
||||
|
||||
# For asset pipelining
|
||||
'edxmako',
|
||||
'edxmako.apps.EdxMakoConfig',
|
||||
'pipeline',
|
||||
'static_replace',
|
||||
'webpack_loader',
|
||||
|
||||
Reference in New Issue
Block a user