Example #1
0
def initdb():
    # A request_context is required to use these helper functions
    with new_app(app).request_context(create_environ()):
        db.drop_all()
        db.create_all()
        readaction = schema.Action("read")
        insertaction = schema.Action("insert")
        deleteaction = schema.Action("delete")
        editaction = schema.Action("edit")
        db.session.add(readaction)
        db.session.add(insertaction)
        db.session.add(deleteaction)
        db.session.add(editaction)
        administrator = schema.User(username="******",
                                    password="******",
                                    firstname="admin",
                                    lastname="admin",
                                    email="*****@*****.**")
        administrator.actions.append(readaction)
        administrator.actions.append(insertaction)
        administrator.actions.append(deleteaction)
        administrator.actions.append(editaction)

        db.session.add(administrator)
        db.session.commit()
Example #2
0
def _make_context():
    return dict(app=new_app(app), db=db, models=schema)
Example #3
0
def initdb():
    # A request_context is required to use these helper functions
    with new_app(app).request_context(create_environ()):
        db.drop_all()
        db.create_all()