mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
u
This commit is contained in:
@@ -8,6 +8,11 @@ import time
|
||||
from flask import Flask
|
||||
from datetime import timedelta
|
||||
|
||||
sys.path.append(os.getcwd() + "/class/core")
|
||||
sys.setdefaultencoding('utf-8')
|
||||
import db
|
||||
import public
|
||||
|
||||
|
||||
class config:
|
||||
__version = '0.0.1'
|
||||
@@ -24,8 +29,20 @@ class config:
|
||||
app.config['SECRET_KEY'] = os.urandom(24)
|
||||
app.config['PERMANENT_SESSION_LIFETIME'] = timedelta(days=7)
|
||||
__app = app
|
||||
|
||||
self.initDB()
|
||||
return app
|
||||
|
||||
def initDB(self):
|
||||
try:
|
||||
sql = db.Sql().dbfile('default')
|
||||
csql = public.readFile('data/sql/default.sql')
|
||||
csql_list = csql.split(';')
|
||||
for index in range(len(csql_list)):
|
||||
sql.execute(csql_list[index], ())
|
||||
except Exception, ex:
|
||||
print str(ex)
|
||||
|
||||
def getVersion(self):
|
||||
return self.__version
|
||||
|
||||
|
||||
Reference in New Issue
Block a user