def pre_requesicao(): g.db = conectar_bd()
def criar_bd(): with closing(conectar_bd()) as bd: with app.open_resource('esquema.sql') as sql: bd.cursor().executescript(sql.read().decode('utf-8')) bd.commit()