from app import Story, Paragraph, db db.drop_all() db.create_all() BEGIN_WORDS = [ ( "候选" + "甲", "男生。某传统工科。那年他收到了华清大学的录取通知书……", "boy1.jpg" ), ( "候选" + "乙", "女生。商科和管理学科。那年她收到了华清大学的录取通知书……", "girl1.jpg" ), ( "候选" + "丙", "男生。艺术特长生。那年他收到了华清大学的录取通知书……", "boy2.jpg" ), ( "候选" + "丁", "女生。某热门工科。那年她收到了华清大学的录取通知书……", "girl2.jpg" ), ( "候选" + "戊", "男生。理科。那年他收到了华清大学的录取通知书……", "boy3.jpg" ), ( "候选" + "己", "女生。不喜欢打扮。那年她收到了华清大学的录取通知书……", "girl3.jpg" ), ( "候选" + "庚", "男生。喜欢穿风衣。那年他收到了华清大学的录取通知书……", "boy4.jpg" ), ( "候选" + "辛", "女生。出门一般都戴帽子。那年她收到了华清大学的录取通知书……", "girl4.jpg" ), ( "候选" + "壬", "猫猫。那年它不小心从西门溜进了华清大学……", "cat.jpg" ), ( "候选" + "癸", "留学生。那年华清大学的录取通知书漂洋过海寄到了家里……", "neutral.jpg" ), ] for idx, (title, text, avatar) in zip(range(1, 11), BEGIN_WORDS): s = Story(id=idx, title=title, text=text, tail=idx, avatar="/ordinary/static/img/" + avatar) p = Paragraph(id=idx, text=text, story_id=idx, is_chosen=True, author="初始设定") db.session.add(s) db.session.add(p) db.session.commit()