-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathrun_with_dummy.py
More file actions
32 lines (26 loc) · 856 Bytes
/
run_with_dummy.py
File metadata and controls
32 lines (26 loc) · 856 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
from app import app, db
from app.models import Label, Memo
import random
import time
if __name__ == "__main__":
db.drop_all()
db.create_all()
for i in range(10):
label = Label("{}번째 라벨".format(i + 1))
db.session.add(label)
db.session.commit()
for i in range(30):
memo = Memo("{}번째 메모".format(i + 1),
"내용내용내용내용내용내용내용내용내용",
int(time.time() * 1000 * 0.95),
[])
db.session.add(memo)
db.session.commit()
for i in range(100):
label = random.choice(Label.query.all())
memo = random.choice(Memo.query.all())
if label not in memo.labels:
memo.labels.append(label)
db.session.add(memo)
db.session.commit()
app.run(debug = True)