def environment(argv=sys.argv):
    """Handles initializing and closing down the app and logging."""

    ini_path = argv[1]
    env = bootstrap(ini_path)
    lconf.fileConfig(ini_path)

    conf = appconfig('config:' + ini_path, relative_to=".")

    # Bind Engine Based on Config
    engine = engine_from_config(conf, 'sqlalchemy.')
    models.initialize_sql(engine)

    try:
        yield env
    finally:
        env["closer"]()
Exemple #2
0
def environment(argv=sys.argv):
    """Handles initializing and closing down the app and logging."""

    ini_path = argv[1]
    env = bootstrap(ini_path)
    lconf.fileConfig(ini_path)

    conf = appconfig('config:' + ini_path, 
            relative_to=".")

    # Bind Engine Based on Config
    engine = engine_from_config(conf, 'sqlalchemy.')
    models.initialize_sql(engine)

    try:
        yield env
    finally:
        env["closer"]()
def _initTestingDB():
    global session
    if session: return session

    ini_path = os.environ.get("TEST_INI", 'development.ini')

    conf = appconfig('config:' + ini_path, relative_to=".")

    # Bind Engine Based on Config
    engine = engine_from_config(conf, 'sqlalchemy.')
    session = models.initialize_sql(engine)

    return session
Exemple #4
0
def _initTestingDB():
    global session
    if session: return session

    ini_path = os.environ.get("TEST_INI", 'development.ini')

    conf = appconfig('config:' + ini_path, 
            relative_to=".")

    # Bind Engine Based on Config
    engine = engine_from_config(conf, 'sqlalchemy.')
    session = models.initialize_sql(engine)

    return session