示例#1
0
文件: manager.py 项目: solpie/Pixtch
def init():
    db.init_app(app)
    db.drop_all(app=app)
    db.create_all(app=app)
    print("init...db")

    email = app.config.get('ADMINS')[0]
    admin = User('admin', email, '-+')
    db.session.add(admin)

    user2 = User('user2', '*****@*****.**', '-+')
    db.session.add(user2)

    uppo = Uppo()
    uppo.name_p = 'admin P'
    uppo.id = 2
    # uppo.user = user2
    db.session.add(uppo)

    p = KnPost(u'test post')
    p.html_content = 'this is a test post from manager'
    db.session.add(p)

    db.session.commit()
    print("create...admin")
示例#2
0
文件: manager.py 项目: solpie/Pixtch
def post():
    db.init_app(app)
    for i in range(0, 10):
        p = KnPost(u'test post ' + str(i))
        p.html_content = 'this is a test post from manager'
        db.session.add(p)
    db.session.commit()
    print('create test post')