module_loader: Split the URLs inclusion step

This is useful if we need to perform URL reversing operations before loading
modules.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
Sunil Mohan Adapa authored and James Valleroy committed 2017-05-05 22:31:32 -04:00
1 parent 520347cc1b
commit dd196c504d
2 files changed
+10 -2

No files matched your search

+7 -2
View File
@@ -37,6 +37,13 @@ loaded_modules = collections.OrderedDict()
_modules_to_load = None
def include_urls():
"""Include the URLs of the modules into main Django project."""
for module_import_path in get_modules_to_load():
module_name = module_import_path.split('.')[-1]
_include_module_urls(module_import_path, module_name)
def load_modules():
"""
Read names of enabled modules in modules/enabled directory and
@@ -55,8 +62,6 @@ def load_modules():
if cfg.debug:
raise
_include_module_urls(module_import_path, module_name)
ordered_modules = []
remaining_modules = dict(modules) # Make a copy
for module_name in modules: