mdserver-web/app.py

56 lines
1.1 KiB
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
import time
from datetime import timedelta
2018-10-02 09:50:10 -04:00
2018-11-08 04:38:15 -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-10-14 05:37:43 -04:00
from flask import Flask
2018-09-26 08:02:11 -04:00
app = Flask(__name__)
app.debug = True
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-10-07 23:52:55 -04:00
# print "time.time(): %f " % time.time()
2018-10-07 04:29:42 -04:00
app.config.version = "0.0.1" + str(time.time())
2018-10-14 05:37:43 -04:00
app.config['SECRET_KEY'] = os.urandom(24)
app.config['PERMANENT_SESSION_LIFETIME'] = timedelta(days=7)
2018-10-02 04:59:56 -04: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