Пример #1
0
def main():
    # create db
    # create admin account
    # create hms container in swift
    argv = sys.argv
    if len(argv) == 1:
        models.create_tables(conf)
    elif len(argv) == 2 and argv[1] == 'init':
        try:
            models.create_tables(conf, create_initdata=True)
        except:
            print('already created init data')
            models.create_tables(conf)
    elif len(argv) == 3 and argv[1] == 'delete' and argv[2] == 'db':
        try:
            os.remove('{}.sqlite3'.format(conf.db_filename))
            models.create_tables(conf, create_initdata=True)
        except:
            print('delete database failed')
    else:
        print('arg wrong, should be "init"')

    start_gateway_service()