File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22 :copyright: © 2019 by the Lin team.
33 :license: MIT, see LICENSE for more details.
44"""
5+ from sqlalchemy .exc import IntegrityError
56
67from app .app import create_app
78from lin .db import db
89from lin .core import User
910
10- app = create_app ()
11- with app .app_context ():
12- with db .auto_commit ():
13- # 创建一个超级管理员
14- user = User ()
15- user .nickname = 'super'
16- user .password = '123456'
17- user .email = '1234995678@qq.com'
18- # admin 2 的时候为超级管理员,普通用户为 1
19- user .admin = 2
20- db .session .add (user )
11+ def main ():
12+ app = create_app ()
13+ with app .app_context ():
14+ with db .auto_commit ():
15+ # 创建一个超级管理员
16+ user = User ()
17+ user .nickname = 'super'
18+ user .password = '123456'
19+ user .email = '1234995678@qq.com'
20+ # admin 2 的时候为超级管理员,普通用户为 1
21+ user .admin = 2
22+ db .session .add (user )
23+
24+
25+ if __name__ == '__main__' :
26+ try :
27+ main ()
28+ print ("新增超级管理员成功" )
29+ except Exception as e :
30+ raise e
Original file line number Diff line number Diff line change 1212# 令牌配置
1313JWT_ACCESS_TOKEN_EXPIRES = timedelta (hours = 1 )
1414
15+ # 屏蔽 sql alchemy 的 FSADeprecationWarning
16+ SQLALCHEMY_TRACK_MODIFICATIONS = False
17+
1518# 插件模块暂时没有开启,以下配置可忽略
1619# plugin config写在字典里面
1720PLUGIN_PATH = {
You can’t perform that action at this time.
0 commit comments