Now, paramecio2 load automatically the wsgi flask apps
This commit is contained in:
parent
f4f4e69a16
commit
90e0838459
4 changed files with 32 additions and 17 deletions
|
|
@ -25,11 +25,35 @@ def start_app():
|
||||||
arr_module_path={}
|
arr_module_path={}
|
||||||
|
|
||||||
# Load blueprints
|
# Load blueprints
|
||||||
|
|
||||||
|
for key_app, added_app in config.apps.items():
|
||||||
|
|
||||||
for added_app in config.apps:
|
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])
|
||||||
|
|
||||||
|
arr_module_path[key_app]=os.path.dirname(sys.modules[module_app].__file__)
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
module_app=config.apps[added_app][0]
|
module_app=config.apps[added_app][0]
|
||||||
|
|
||||||
a=import_module(module_app)
|
a=import_module(module_app)
|
||||||
#print(added_app, file=sys.stdout)
|
#print(added_app, file=sys.stdout)
|
||||||
app_name=getattr(a, config.apps[added_app][1])
|
app_name=getattr(a, config.apps[added_app][1])
|
||||||
|
|
@ -37,6 +61,7 @@ def start_app():
|
||||||
app.register_blueprint(app_name, url_prefix=config.apps[added_app][2])
|
app.register_blueprint(app_name, url_prefix=config.apps[added_app][2])
|
||||||
|
|
||||||
arr_module_path[added_app]=os.path.dirname(sys.modules[module_app].__file__)
|
arr_module_path[added_app]=os.path.dirname(sys.modules[module_app].__file__)
|
||||||
|
"""
|
||||||
|
|
||||||
#Add media files support. Only for development.
|
#Add media files support. Only for development.
|
||||||
|
|
||||||
|
|
|
||||||
0
paramecio2/modules/admin/__init__.py
Normal file
0
paramecio2/modules/admin/__init__.py
Normal file
|
|
@ -64,14 +64,13 @@ def admin_finished(response):
|
||||||
|
|
||||||
for app in config.apps:
|
for app in config.apps:
|
||||||
module_app=config.apps[app][0]
|
module_app=config.apps[app][0]
|
||||||
|
|
||||||
module_path=os.path.dirname(sys.modules[module_app].__file__)
|
module_path=os.path.dirname(sys.modules[module_app].__file__)
|
||||||
|
|
||||||
if os.path.isfile(module_path+'/settings/config_admin.py'):
|
if os.path.isfile(module_path+'/settings/config_admin.py'):
|
||||||
#print(module_path+'/settings/config_admin.py')
|
|
||||||
pos_last_point=module_app.rfind('.')
|
config_path=module_app+'.settings.config_admin'
|
||||||
|
|
||||||
config_path=module_app[:pos_last_point]+'.settings.config_admin'
|
|
||||||
|
|
||||||
a=import_module(config_path)
|
a=import_module(config_path)
|
||||||
|
|
||||||
arr_modules_admin={}
|
arr_modules_admin={}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
from flask import Blueprint
|
|
||||||
|
|
||||||
|
|
||||||
welcome=Blueprint('welcome', __name__, template_folder='templates')
|
|
||||||
|
|
||||||
@welcome.route('/welcome')
|
|
||||||
def home():
|
|
||||||
|
|
||||||
return "WELCOME TO FLASK APPLICATION"
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue