MCPcopy Index your code
hub / github.com/plotly/dash / start

Method start

dash/testing/application_runners.py:241–272  ·  view source on GitHub ↗
(self, app, start_timeout=3, **kwargs)

Source from the content-addressed store, hash-verified

239
240 # pylint: disable=arguments-differ
241 def start(self, app, start_timeout=3, **kwargs):
242 self.port = kwargs.get("port", 8050)
243
244 def target():
245 app.scripts.config.serve_locally = True
246 app.css.config.serve_locally = True
247
248 options = kwargs.copy()
249
250 try:
251 module = app.server.__class__.__module__
252 # FastAPI support
253 if module.startswith("fastapi"):
254 app.run(**options)
255 # Quart support (ASGI - runs its own async event loop)
256 elif module.startswith("quart"):
257 app.run(**options)
258 # Flask fallback (WSGI - needs threaded mode)
259 else:
260 app.run(threaded=True, **options)
261 except SystemExit:
262 logger.info("Server stopped")
263 raise
264 except Exception as error:
265 logger.exception(error)
266 raise error
267
268 self.proc = multiprocess.Process(target=target) # type: ignore[reportAttributeAccessIssue]; pylint: disable=not-callable
269 self.proc.start()
270
271 wait.until(lambda: self.accessible(self.url), timeout=start_timeout)
272 self.started = True
273
274 def stop(self):
275 process = psutil.Process(self.proc.pid) # type: ignore[reportOptionalMemberAccess]

Callers

nothing calls this directly

Calls 3

accessibleMethod · 0.80
getMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected