Пример #1
0
 def run(self, args):
     super(PopulateCommand, self).run(args)
     out("LOADING ENVIRONMENT")
     self.load_app()
     models.init_model()
     out("BUILDING SCHEMA")
     try:
         out("STARTING A TRANSACTION...")
         models.start()
         models.Base.metadata.create_all(conf.sqlalchemy.engine)
     except:
         models.rollback()
         out("ROLLING BACK... ")
         raise
     else:
         out("COMMITING... ")
         models.commit()
Пример #2
0
def setup_app(config):

    models.init_model()
    app_conf = dict(config.app)

    return make_app(app_conf.pop("root"), logging=getattr(config, "logging", {}), **app_conf)