forked from lmayZhou/hexo-blog-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init_databases.py
28 lines (26 loc) · 915 Bytes
/
init_databases.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ----------------------------------------------------------
# --
# --
# ****************************
# Author: lmay.Zhou
# Email: [email protected]
# Blog: www.lmaye.com
# Date: 2018/4/21 0:37 星期六
# ----------------------------------------------------------
from datetime import datetime
from core.models.user import User
from core.app import db
from core.models.role import Role
from core.utils.security import Security
if __name__ == '__main__':
now = datetime.utcnow() + datetime.timedelta(hours=8)
role = Role(role_code="R0000", role_name="管理员", last_date=now)
db.session.add(role)
db.session.commit()
sc = Security("lmayZhou")
user = User(nickname="lmay", password=sc.encrypt("root@123").replace("\n", ""), email="[email protected]",
qq="379839355", last_date=now)
db.session.add(user)
db.session.commit()