Simple Linux Panel
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mdserver-web/app.py

54 lines
1.1 KiB

7 years ago
# coding:utf-8
7 years ago
import sys
import io
import os
7 years ago
reload(sys)
sys.setdefaultencoding('utf8')
7 years ago
import route
7 years ago
from flask import Flask
from datetime import timedelta
7 years ago
sys.path.append("class/")
7 years ago
app = Flask(__name__)
app.debug = True
7 years ago
7 years ago
DEFAULT_MODULES = (
7 years ago
(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"),
7 years ago
)
7 years ago
import time
7 years ago
# print "time.time(): %f " % time.time()
7 years ago
app.config.version = "0.0.1" + str(time.time())
7 years ago
app.config['SECRET_KEY'] = os.urandom(24)
app.config['PERMANENT_SESSION_LIFETIME'] = timedelta(days=7)
7 years ago
7 years ago
def setting_modules(app, modules):
for module, url_prefix in modules:
app.register_blueprint(module, url_prefix=url_prefix)
setting_modules(app, DEFAULT_MODULES)
7 years ago
try:
if __name__ == "__main__":
app.run()
except Exception as ex:
return str(ex)