MCPcopy
hub / github.com/plotly/dash / _setup_server

Method _setup_server

dash/dash.py:1617–1697  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1615 return partial_func
1616
1617 def _setup_server(self):
1618 if self._got_first_request["setup_server"]:
1619 return
1620
1621 self._got_first_request["setup_server"] = True
1622
1623 # Apply _force_eager_loading overrides from modules
1624 eager_loading = self.config.eager_loading
1625 for module_name in ComponentRegistry.registry:
1626 module = sys.modules[module_name]
1627 eager = getattr(module, "_force_eager_loading", False)
1628 eager_loading = eager_loading or eager
1629
1630 # Update eager_loading settings
1631 self.scripts.config.eager_loading = eager_loading
1632
1633 if self.config.include_assets_files:
1634 self._walk_assets_directory()
1635
1636 if not self.layout and self.use_pages:
1637 self.layout = page_container
1638
1639 _validate.validate_layout(self.layout, self._layout_value())
1640
1641 self._generate_scripts_html()
1642 self._generate_css_dist_html()
1643
1644 # Copy over global callback data structures assigned with `dash.callback`
1645 for k in list(_callback.GLOBAL_CALLBACK_MAP):
1646 if k in self.callback_map:
1647 raise DuplicateCallback(
1648 f"The callback `{k}` provided with `dash.callback` was already "
1649 "assigned with `app.callback`."
1650 )
1651
1652 self.callback_map[k] = _callback.GLOBAL_CALLBACK_MAP.pop(k)
1653
1654 self._callback_list.extend(_callback.GLOBAL_CALLBACK_LIST)
1655
1656 # For each callback function, if the hidden parameter uses the default value None,
1657 # replace it with the actual value of the self.config.hide_all_callbacks.
1658 self._callback_list = [
1659 (
1660 {**_callback, "hidden": self.config.get("hide_all_callbacks", False)}
1661 if _callback.get("hidden") is None
1662 else _callback
1663 )
1664 for _callback in self._callback_list
1665 ]
1666
1667 _callback.GLOBAL_CALLBACK_LIST.clear()
1668
1669 _validate.validate_background_callbacks(self.callback_map)
1670
1671 cancels = {}
1672
1673 for callback in self.callback_map.values():
1674 background = callback.get("background")

Callers 1

_make_appMethod · 0.95

Calls 9

_layout_valueMethod · 0.95
DuplicateCallbackClass · 0.85
popMethod · 0.80
extendMethod · 0.45
getMethod · 0.45
clearMethod · 0.45

Tested by 1

_make_appMethod · 0.76