mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-04-29 10:10:19 +00:00
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:
parent
520347cc1b
commit
dd196c504d
@ -328,6 +328,8 @@ def main():
|
|||||||
logger.info('Configuration loaded from file - %s', cfg.config_file)
|
logger.info('Configuration loaded from file - %s', cfg.config_file)
|
||||||
logger.info('Script prefix - %s', cfg.server_dir)
|
logger.info('Script prefix - %s', cfg.server_dir)
|
||||||
|
|
||||||
|
module_loader.include_urls()
|
||||||
|
|
||||||
module_loader.load_modules()
|
module_loader.load_modules()
|
||||||
if arguments.setup is not False:
|
if arguments.setup is not False:
|
||||||
run_setup_and_exit(arguments.setup)
|
run_setup_and_exit(arguments.setup)
|
||||||
@ -349,5 +351,6 @@ def main():
|
|||||||
cherrypy.engine.start()
|
cherrypy.engine.start()
|
||||||
cherrypy.engine.block()
|
cherrypy.engine.block()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|||||||
@ -37,6 +37,13 @@ loaded_modules = collections.OrderedDict()
|
|||||||
_modules_to_load = None
|
_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():
|
def load_modules():
|
||||||
"""
|
"""
|
||||||
Read names of enabled modules in modules/enabled directory and
|
Read names of enabled modules in modules/enabled directory and
|
||||||
@ -55,8 +62,6 @@ def load_modules():
|
|||||||
if cfg.debug:
|
if cfg.debug:
|
||||||
raise
|
raise
|
||||||
|
|
||||||
_include_module_urls(module_import_path, module_name)
|
|
||||||
|
|
||||||
ordered_modules = []
|
ordered_modules = []
|
||||||
remaining_modules = dict(modules) # Make a copy
|
remaining_modules = dict(modules) # Make a copy
|
||||||
for module_name in modules:
|
for module_name in modules:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user