Skip to content

Commit eb65854

Browse files
authored
Merge branch 'dash-3.0' into fix/wrapper
2 parents 51dfddf + 0e38ed2 commit eb65854

File tree

1 file changed

+27
-20
lines changed

1 file changed

+27
-20
lines changed

dash/dash.py

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2010,25 +2010,26 @@ def delete_resource(resources):
20102010
# pylint: disable=protected-access
20112011
delete_resource(self.css._resources._resources)
20122012

2013+
# pylint: disable=too-many-branches
20132014
def run(
20142015
self,
2015-
host="127.0.0.1",
2016-
port="8050",
2017-
proxy=None,
2018-
debug=None,
2016+
host: Optional[str] = None,
2017+
port: Optional[Union[str, int]] = None,
2018+
proxy: Optional[str] = None,
2019+
debug: Optional[bool] = None,
20192020
jupyter_mode: Optional[JupyterDisplayMode] = None,
2020-
jupyter_width="100%",
2021-
jupyter_height=650,
2022-
jupyter_server_url=None,
2023-
dev_tools_ui=None,
2024-
dev_tools_props_check=None,
2025-
dev_tools_serve_dev_bundles=None,
2026-
dev_tools_hot_reload=None,
2027-
dev_tools_hot_reload_interval=None,
2028-
dev_tools_hot_reload_watch_interval=None,
2029-
dev_tools_hot_reload_max_retry=None,
2030-
dev_tools_silence_routes_logging=None,
2031-
dev_tools_prune_errors=None,
2021+
jupyter_width: str = "100%",
2022+
jupyter_height: int = 650,
2023+
jupyter_server_url: Optional[str] = None,
2024+
dev_tools_ui: Optional[bool] = None,
2025+
dev_tools_props_check: Optional[bool] = None,
2026+
dev_tools_serve_dev_bundles: Optional[bool] = None,
2027+
dev_tools_hot_reload: Optional[bool] = None,
2028+
dev_tools_hot_reload_interval: Optional[int] = None,
2029+
dev_tools_hot_reload_watch_interval: Optional[int] = None,
2030+
dev_tools_hot_reload_max_retry: Optional[int] = None,
2031+
dev_tools_silence_routes_logging: Optional[bool] = None,
2032+
dev_tools_prune_errors: Optional[bool] = None,
20322033
**flask_run_options,
20332034
):
20342035
"""Start the flask server in local mode, you should not run this on a
@@ -2037,11 +2038,11 @@ def run(
20372038
If a parameter can be set by an environment variable, that is listed
20382039
too. Values provided here take precedence over environment variables.
20392040
2040-
:param host: Host IP used to serve the application
2041+
:param host: Host IP used to serve the application, default to "127.0.0.1"
20412042
env: ``HOST``
20422043
:type host: string
20432044
2044-
:param port: Port used to serve the application
2045+
:param port: Port used to serve the application, default to "8050"
20452046
env: ``PORT``
20462047
:type port: int
20472048
@@ -2142,8 +2143,14 @@ def run(
21422143

21432144
# Evaluate the env variables at runtime
21442145

2145-
host = host or os.getenv("HOST")
2146-
port = port or os.getenv("PORT")
2146+
if "CONDA_PREFIX" in os.environ:
2147+
# Some conda systems has issue with setting the host environment
2148+
# to an invalid hostname.
2149+
# Related issue: https://github.com/plotly/dash/issues/3069
2150+
host = host or "127.0.0.1"
2151+
else:
2152+
host = host or os.getenv("HOST", "127.0.0.1")
2153+
port = port or os.getenv("PORT", "8050")
21472154
proxy = proxy or os.getenv("DASH_PROXY")
21482155

21492156
# Verify port value

0 commit comments

Comments
 (0)