Support for mount apps
This commit is contained in:
parent
3c3981ef87
commit
2ddb0699ae
2 changed files with 34 additions and 1 deletions
|
|
@ -38,7 +38,7 @@ def make_url(path, query_args={}):
|
||||||
get_query='?'+urllib.parse.urlencode(query_args)
|
get_query='?'+urllib.parse.urlencode(query_args)
|
||||||
|
|
||||||
return config.base_url+path+get_query
|
return config.base_url+path+get_query
|
||||||
|
|
||||||
def make_url_domain(path, query_args={}):
|
def make_url_domain(path, query_args={}):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,39 @@ def prepare_app():
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
app_mounts={}
|
||||||
|
|
||||||
|
for key_app, added_app in config.apps.items():
|
||||||
|
|
||||||
|
controller_path=import_module(added_app[0])
|
||||||
|
|
||||||
|
controller_base=os.path.dirname(controller_path.__file__)
|
||||||
|
|
||||||
|
dir_controllers=os.listdir(controller_base)
|
||||||
|
|
||||||
|
for controller in dir_controllers:
|
||||||
|
|
||||||
|
if controller.find('.py')!=-1 and controller.find('__init__')==-1:
|
||||||
|
|
||||||
|
controller_py=controller.replace('.py', '')
|
||||||
|
|
||||||
|
module_app=added_app[0]+'.'+controller_py
|
||||||
|
|
||||||
|
a=import_module(module_app)
|
||||||
|
|
||||||
|
app_name=getattr(a, added_app[1])
|
||||||
|
|
||||||
|
#app.register_blueprint(app_name, url_prefix=added_app[2])
|
||||||
|
|
||||||
|
#app.mount(added_app[2], app_name)
|
||||||
|
app_mounts[added_app[2]]=app_name
|
||||||
|
|
||||||
|
arr_module_path[key_app]=os.path.dirname(sys.modules[module_app].__file__)
|
||||||
|
|
||||||
|
for k_app,v_app in app_mounts.items():
|
||||||
|
|
||||||
|
app.mount(k_app, v_app)
|
||||||
|
|
||||||
set_timezone()
|
set_timezone()
|
||||||
|
|
||||||
if error_reporting:
|
if error_reporting:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue