MCPcopy Index your code
hub / github.com/pywebio/PyWebIO / _setup_server

Function _setup_server

pywebio/platform/tornado.py:192–207  ·  view source on GitHub ↗
(webio_handler, port=0, host='', static_dir=None, max_buffer_size=2 ** 20 * 200,
                  **tornado_app_settings)

Source from the content-addressed store, hash-verified

190
191
192def _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
210def start_server(applications: Union[Callable[[], None], List[Callable[[], None]], Dict[str, Callable[[], None]]],

Callers 3

start_serverFunction · 0.85
start_serverFunction · 0.85
server_threadFunction · 0.85

Calls 2

get_free_portFunction · 0.85
appendMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…