File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ """
2+ :copyright: © 2019 by the Lin team.
3+ :license: MIT, see LICENSE for more details.
4+ """
5+
6+ from app .app import create_app
7+ from lin .db import db
8+ from lin .core import User
9+
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+ # super为 2 的时候为超级管理员,普通用户为 1
19+ user .super = 2
20+ db .session .add (user )
Original file line number Diff line number Diff line change 66from app .app import create_app
77from app .models .book import Book
88from lin .db import db
9- from lin .core import User
109
1110app = create_app ()
1211with app .app_context ():
1312 with db .auto_commit ():
14- # 创建一个超级管理员
15- user = User ()
16- user .nickname = 'super'
17- user .password = '123456'
18- user .email = '12345678@qq.com'
19- user .super = 2
20- db .session .add (user )
2113 # 添加书籍
2214 book1 = Book ()
2315 book1 .title = '深入理解计算机系统'
You can’t perform that action at this time.
0 commit comments