def command_line_runner(): parser = get_parser() args = vars(parser.parse_args()) port = args['port'] global app if args["w"]: app = app.create_app() t1 = threading.Thread(target=app.run, args=('0.0.0.0', port)) t1.start() elif args["m"]: me = MetadataStorage(60) me.init_index() t2 = threading.Thread(target=me.start) t2.start() elif args["a"]: me = MetadataStorage(60) me.init_index() t2 = threading.Thread(target=me.start) t2.start() apps = app.create_app() t1 = threading.Thread(target=apps.run, args=('0.0.0.0', port)) t1.start()