-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmanage.py
More file actions
36 lines (26 loc) · 867 Bytes
/
Copy pathmanage.py
File metadata and controls
36 lines (26 loc) · 867 Bytes
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
29
30
31
32
33
34
35
36
#/usr/bin/env python3
# -*- coding: utf-8 -*-
from flask_script import Manager
from app import create_app
from app.admin.models import Admin
from app.public.models import Tags
app = create_app('production')
manager = Manager(app)
@manager.command
def create_admin():
name = 'admin'
password = 'maxin123'
admin = Admin(name=name)
admin.password = password
admin.save()
print("ok, you successful create a admin")
@manager.command
def create_tags():
tags_list = ['编程', 'Python', 'java', '计算机',
'动漫', '人工智能', 'C++', '美女', '帅哥', '人生']
for tag_name in tags_list:
tag = Tags(name=tag_name)
tag.save()
print("ok, you successful create many tags")
if __name__ == '__main__':
app.run(host='127.0.0.1', port=5000,debug=True)