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()
def _make_context(): return dict(app=new_app(app), db=db, models=schema)
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()