from app import Story, Paragraph, db db.drop_all() db.create_all() AVATARS = [ ( "候选" + "甲", "boy1.jpg" ), ( "候选" + "乙", "girl1.jpg" ), ( "候选" + "丙", "boy2.jpg" ), ( "候选" + "丁", "girl2.jpg" ), ( "候选" + "戊", "boy3.jpg" ), ( "候选" + "己", "girl3.jpg" ), ( "候选" + "庚", "boy4.jpg" ), ( "候选" + "辛", "girl4.jpg" ), ( "候选" + "壬", "cat.jpg" ), ( "候选" + "癸", "neutral.jpg" ), ] for idx, (title, avatar) in zip(range(1, 11), AVATARS): s = Story(id=idx, title=title, text='', tail=idx, is_tree=(idx == 10), avatar="/ordinary/static/img/" + avatar) p = Paragraph(id=idx, text='', story_id=idx, is_chosen=True, author="初始设定") db.session.add(s) db.session.add(p) db.session.commit()