예제 #1
0
def init_db():
    from quizr.models import DBSession
    from quizr.models import Base
    from sqlalchemy import create_engine
    engine = create_engine('sqlite://')
    DBSession.configure(bind=engine)
    Base.metadata.bind = engine
    Base.metadata.create_all(engine)
    session = DBSession()
    return session
예제 #2
0
def init_db():
    from quizr.models import DBSession
    from quizr.models import Base
    from sqlalchemy import create_engine
    engine = create_engine('sqlite://')
    DBSession.configure(bind=engine)
    Base.metadata.bind = engine
    Base.metadata.create_all(engine)
    session = DBSession()
    return session
예제 #3
0
def main(argv=sys.argv):
    if len(argv) != 2:
        usage(argv)
    config_uri = argv[1]
    setup_logging(config_uri)
    settings = get_appsettings(config_uri)
    engine = engine_from_config(settings, 'sqlalchemy.')
    db_dir = os.path.dirname(engine.url.database)
    if not os.path.exists(db_dir):
        os.makedirs(db_dir)
    DBSession.configure(bind=engine)
    Base.metadata.create_all(engine)
예제 #4
0
 def tearDown(self):
     import transaction
     from quizr.models import DBSession
     transaction.abort()
     DBSession.remove()
     testing.tearDown()
예제 #5
0
 def tearDown(self):
     import transaction
     from quizr.models import DBSession
     transaction.abort()
     DBSession.remove()
     testing.tearDown()