mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
update
This commit is contained in:
+14
-12
@@ -31,8 +31,9 @@ from flask_migrate import Migrate
|
||||
from flask_caching import Cache
|
||||
from werkzeug.local import LocalProxy
|
||||
|
||||
from admin import model
|
||||
# from admin import model
|
||||
from admin import setup
|
||||
import thisdb
|
||||
|
||||
from admin.model import db as sys_db
|
||||
|
||||
@@ -68,12 +69,13 @@ app.config['SESSION_COOKIE_NAME'] = "MW_VER_1"
|
||||
app.config['PERMANENT_SESSION_LIFETIME'] = timedelta(days=31)
|
||||
|
||||
# db的配置
|
||||
app.config['SQLALCHEMY_DATABASE_URI'] = mw.getSqitePrefix()+config.SQLITE_PATH+"?timeout=20" # 使用 SQLite 数据库
|
||||
# app.config['SQLALCHEMY_DATABASE_URI'] = mw.getSqitePrefix()+config.SQLITE_PATH+"?timeout=20" # 使用 SQLite 数据库
|
||||
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True
|
||||
|
||||
|
||||
# 初始化db
|
||||
sys_db.init_app(app)
|
||||
Migrate(app, sys_db)
|
||||
# sys_db.init_app(app)
|
||||
# Migrate(app, sys_db)
|
||||
|
||||
|
||||
# 检查数据库是否存在。如果没有就创建它。
|
||||
@@ -84,15 +86,15 @@ if not os.path.isfile(config.SQLITE_PATH):
|
||||
# with app.app_context():
|
||||
# sys_db.create_all()
|
||||
|
||||
with app.app_context():
|
||||
if setup_db_required:
|
||||
sys_db.create_all()
|
||||
# with app.app_context():
|
||||
# if setup_db_required:
|
||||
# sys_db.create_all()
|
||||
|
||||
# 初始化用户信息
|
||||
with app.app_context():
|
||||
if setup_db_required:
|
||||
setup.init_admin_user()
|
||||
setup.init_option()
|
||||
if setup_db_required:
|
||||
# 初始化用户信息
|
||||
thisdb.initPanelData()
|
||||
setup.init_admin_user()
|
||||
setup.init_option()
|
||||
setup.init_cmd()
|
||||
setup.init_db_system()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user