mdserver-web/app.py

45 lines
854 B
Python
Raw Normal View History

2018-10-25 04:40:45 -04:00
# coding:utf-8
2018-10-02 09:50:10 -04:00
import sys
import io
import os
2018-11-08 04:22:03 -05:00
2018-10-02 09:50:10 -04:00
2018-12-03 03:44:29 -05:00
sys.path.append("/class/core")
2018-10-25 07:32:21 -04:00
reload(sys)
sys.setdefaultencoding('utf8')
2018-10-17 10:57:37 -04:00
import route
2018-12-03 03:44:29 -05:00
import config
2018-10-14 05:37:43 -04:00
2018-12-03 03:44:29 -05:00
app = config.config().makeApp(__name__)
2018-09-26 08:02:11 -04:00
2018-10-02 09:50:10 -04:00
2018-09-26 08:02:11 -04:00
DEFAULT_MODULES = (
2018-10-17 10:57:37 -04:00
(route.dashboard, "/"),
(route.site, "/site"),
(route.files, "/files"),
(route.soft, "/soft"),
(route.config, "/config"),
(route.plugins, "/plugins"),
(route.task, "/task"),
(route.system, "/system"),
(route.database, "/database"),
(route.crontab, "/crontab"),
(route.firewall, "/firewall"),
(route.control, "/control"),
2018-09-26 08:02:11 -04:00
)
2018-11-08 04:22:03 -05:00
2018-09-26 08:02:11 -04:00
def setting_modules(app, modules):
for module, url_prefix in modules:
app.register_blueprint(module, url_prefix=url_prefix)
setting_modules(app, DEFAULT_MODULES)
2018-10-26 01:53:39 -04:00
try:
if __name__ == "__main__":
app.run()
except Exception as ex:
2018-10-26 03:02:57 -04:00
print ex