def METHOD_NAME(executable, upload_dir, host=None, port=None):
    """Runs webserver in command line, adds routes."""
    if not host:
        host = "localhost"
    if not port:
        port = 8079
    manager = ModulesManager()
    webserver_module = manager.modules_by_name["webserver"]
    server_manager = webserver_module.create_new_server_manager(port, host)
    webserver_url = server_manager.url
    # queue for publishfromapp tasks
    studio_task_queue = collections.deque()
    resource = RestApiResource(server_manager,
                               upload_dir=upload_dir,
                               executable=executable,
                               studio_task_queue=studio_task_queue)
    projects_endpoint = ProjectsEndpoint(resource)
    server_manager.add_route(
        "GET",
        "/api/projects",
        projects_endpoint.dispatch
    )
    hiearchy_endpoint = HiearchyEndpoint(resource)
    server_manager.add_route(
        "GET",
        "/api/hierarchy/{project_name}",
        hiearchy_endpoint.dispatch
    )
    configured_ext_endpoint = ConfiguredExtensionsEndpoint(resource)
    server_manager.add_route(
        "GET",
        "/api/webpublish/configured_ext/{project_name}",
        configured_ext_endpoint.dispatch
    )
    # triggers publish
    webpublisher_task_publish_endpoint = BatchPublishEndpoint(resource)
    server_manager.add_route(
        "POST",
        "/api/webpublish/batch",
        webpublisher_task_publish_endpoint.dispatch
    )
    webpublisher_batch_publish_endpoint = TaskPublishEndpoint(resource)
    server_manager.add_route(
        "POST",
        "/api/webpublish/task",
        webpublisher_batch_publish_endpoint.dispatch
    )
    # reporting
    webpublish_resource = WebpublishRestApiResource()
    batch_status_endpoint = BatchStatusEndpoint(webpublish_resource)
    server_manager.add_route(
        "GET",
        "/api/batch_status/{batch_id}",
        batch_status_endpoint.dispatch
    )
    user_status_endpoint = UserReportEndpoint(webpublish_resource)
    server_manager.add_route(
        "GET",
        "/api/publishes/{user}",
        user_status_endpoint.dispatch
    )
    batch_reprocess_endpoint = BatchReprocessEndpoint(webpublish_resource)
    server_manager.add_route(
        "POST",
        "/api/webpublish/reprocess/{batch_id}",
        batch_reprocess_endpoint.dispatch
    )
    server_manager.start_server()
    last_reprocessed = time.time()
    while True:
        if time.time() - last_reprocessed > 20:
            reprocess_failed(upload_dir, webserver_url)
            last_reprocessed = time.time()
        if studio_task_queue:
            args = studio_task_queue.popleft()
            subprocess.call(args)  # blocking call
        time.sleep(1.0)