This commit is contained in:
flaskfarm
2022-10-22 23:10:07 +09:00
parent 2e46777d12
commit dd32e8a04e
7 changed files with 81 additions and 30 deletions

View File

@@ -46,16 +46,23 @@ class PluginManager:
try:
#plugin_path = F.SystemModelSetting.get('plugin_dev_path')
plugin_path = F.config['path_dev']
if plugin_path != None and plugin_path != '':
if os.path.exists(plugin_path):
sys.path.insert(0, plugin_path)
tmps = os.listdir(plugin_path)
add_plugin_list = []
for t in tmps:
if not t.startswith('_') and os.path.isdir(os.path.join(plugin_path, t)):
add_plugin_list.append(t)
cls.all_package_list[t] = {'pos':'dev', 'path':os.path.join(plugin_path, t), 'loading':True}
plugins = plugins + add_plugin_list
if type(plugin_path) == type(''):
plugin_path_list = [plugin_path]
elif type(plugin_path) == type([]):
plugin_path_list = plugin_path
for __ in plugin_path_list:
if __ != None and __ != '':
if os.path.exists(__):
sys.path.insert(0, __)
tmps = os.listdir(__)
add_plugin_list = []
for t in tmps:
if not t.startswith('_') and os.path.isdir(os.path.join(__, t)):
add_plugin_list.append(t)
cls.all_package_list[t] = {'pos':'dev', 'path':os.path.join(__, t), 'loading':True}
plugins = plugins + add_plugin_list
except Exception as exception:
F.logger.error('Exception:%s', exception)
F.logger.error(traceback.format_exc())