(webio_handler, port=0, host='', static_dir=None, max_buffer_size=2 ** 20 * 200,
**tornado_app_settings)
| 190 | |
| 191 | |
| 192 | def _setup_server(webio_handler, port=0, host='', static_dir=None, max_buffer_size=2 ** 20 * 200, |
| 193 | **tornado_app_settings): |
| 194 | if port == 0: |
| 195 | port = get_free_port() |
| 196 | |
| 197 | handlers = [(r"/", webio_handler)] |
| 198 | |
| 199 | if static_dir is not None: |
| 200 | handlers.append((r"/static/(.*)", tornado.web.StaticFileHandler, {"path": static_dir})) |
| 201 | |
| 202 | handlers.append((r"/(.*)", tornado.web.StaticFileHandler, {"path": STATIC_PATH, 'default_filename': 'index.html'})) |
| 203 | |
| 204 | app = tornado.web.Application(handlers=handlers, **tornado_app_settings) |
| 205 | # Credit: https://stackoverflow.com/questions/19074972/content-length-too-long-when-uploading-file-using-tornado |
| 206 | server = app.listen(port, address=host, max_buffer_size=max_buffer_size) |
| 207 | return server, port |
| 208 | |
| 209 | |
| 210 | def start_server(applications: Union[Callable[[], None], List[Callable[[], None]], Dict[str, Callable[[], None]]], |
no test coverage detected
searching dependent graphs…