def main(argv=sys.argv): if len(argv) != 2: usage(argv) config_uri = argv[1] setup_logging(config_uri) settings = get_appsettings(config_uri) mkdir(settings['static_files']) # Create Ziggurat tables alembic_ini_file = 'alembic.ini' if not os.path.exists(alembic_ini_file): alembic_ini = ALEMBIC_CONF.replace('{{db_url}}', settings['sqlalchemy.url']) f = open(alembic_ini_file, 'w') f.write(alembic_ini) f.close() bin_path = os.path.split(sys.executable)[0] alembic_bin = os.path.join(bin_path, 'alembic') command = '%s upgrade head' % alembic_bin os.system(command) os.remove(alembic_ini_file) # Insert data engine = engine_from_config(settings, 'sqlalchemy.') DBSession.configure(bind=engine) init_model() create_schemas(engine) Base.metadata.create_all(engine) initial_data.insert() transaction.commit()
def main(argv=sys.argv): if len(argv) != 2: usage(argv) config_uri = argv[1] setup_logging(config_uri) settings = get_appsettings(config_uri) # Create Ziggurat tables alembic_ini_file = 'alembic.ini' if not os.path.exists(alembic_ini_file): alembic_ini = ALEMBIC_CONF.replace('{{db_url}}', settings['sqlalchemy.url']) f = open(alembic_ini_file, 'w') f.write(alembic_ini) f.close() bin_path = os.path.split(sys.executable)[0] alembic_bin = os.path.join(bin_path, 'alembic') command = '%s upgrade head' % alembic_bin os.system(command) os.remove(alembic_ini_file) # Insert data engine = engine_from_config(settings, 'sqlalchemy.') DBSession.configure(bind=engine) init_model() Base.metadata.create_all(engine) initial_data.insert()
def main(argv=sys.argv): def alembic_run(ini_file): s = read_file(ini_file) s = s.replace('{{db_url}}', settings['sqlalchemy.url']) f = open('alembic.ini', 'w') f.write(s) f.close() subprocess.call(command) os.remove('alembic.ini') if len(argv) != 2: usage(argv) config_uri = argv[1] setup_logging(config_uri) settings = get_appsettings(config_uri) # Create Ziggurat tables bin_path = os.path.split(sys.executable)[0] alembic_bin = os.path.join(bin_path, 'alembic') command = (alembic_bin, 'upgrade', 'head') alembic_run('alembic.ini.tpl') alembic_run('alembic_upgrade.ini.tpl') # Insert data engine = engine_from_config(settings, 'sqlalchemy.') DBSession.configure(bind=engine) init_model() #create_schemas(engine) Base.metadata.create_all(engine) initial_data.insert() transaction.commit()
def main(argv=sys.argv): if len(argv) != 2: usage(argv) config_uri = argv[1] setup_logging(config_uri) settings = get_appsettings(config_uri) ziggurat_init(settings) mkdir(settings['static_files']) # Insert data engine = engine_from_config(settings, 'sqlalchemy.') DBSession.configure(bind=engine) init_model() create_schemas(engine) Base.metadata.create_all(engine) initial_data.insert() transaction.commit()