From 6353ae736dc3cdf2c3ca5afbaa77ce747bbe8a78 Mon Sep 17 00:00:00 2001 From: martian0x80 <26498920+martian0x80@users.noreply.github.com> Date: Sat, 29 Jun 2024 00:26:24 +0530 Subject: [PATCH 1/3] fix: evaluate HOST, PORT, and PROXY when Dash.run is invoked, fixes #2902 --- dash/dash.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dash/dash.py b/dash/dash.py index b17ef80c96..1ec34023fc 100644 --- a/dash/dash.py +++ b/dash/dash.py @@ -2109,6 +2109,12 @@ def run( dev_tools_prune_errors, ) + # Evaluate the env variables at runtime + + host = os.getenv("HOST", host) + port = os.getenv("PORT", port) + proxy = os.getenv("DASH_PROXY", proxy) + # Verify port value try: port = int(port) From 5e1786bd617bdbcfcc99928081035f45020b0aab Mon Sep 17 00:00:00 2001 From: martian0x80 <26498920+martian0x80@users.noreply.github.com> Date: Wed, 3 Jul 2024 14:59:31 +0530 Subject: [PATCH 2/3] chore: assign None to host, port, proxy parameters --- dash/dash.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dash/dash.py b/dash/dash.py index 1ec34023fc..f9cc2139f3 100644 --- a/dash/dash.py +++ b/dash/dash.py @@ -1981,9 +1981,9 @@ def delete_resource(resources): def run( self, - host=os.getenv("HOST", "127.0.0.1"), - port=os.getenv("PORT", "8050"), - proxy=os.getenv("DASH_PROXY", None), + host=None, + port=None, + proxy=None, debug=None, jupyter_mode: JupyterDisplayMode = None, jupyter_width="100%", From 8adf717c5a2f122d6d5dd93ef8d9a945463df65c Mon Sep 17 00:00:00 2001 From: martian0x80 <26498920+martian0x80@users.noreply.github.com> Date: Wed, 3 Jul 2024 20:09:32 +0530 Subject: [PATCH 3/3] chore: assign default params to host, port parameters in Dash.run() --- CHANGELOG.md | 1 + dash/dash.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e50c9449bc..1d5986c457 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ This project adheres to [Semantic Versioning](https://semver.org/). - [#2898](https://github.com/plotly/dash/pull/2898) Fix error thrown when using non-existent components in callback running keyword. Fixes [#2897](https://github.com/plotly/dash/issues/2897). - [#2892](https://github.com/plotly/dash/pull/2860) Fix ensures dcc.Dropdown menu maxHeight option works with Datatable. Fixes [#2529](https://github.com/plotly/dash/issues/2529) [#2225](https://github.com/plotly/dash/issues/2225) - [#2896](https://github.com/plotly/dash/pull/2896) The tabIndex parameter of Div can accept number or string type. Fixes [#2891](https://github.com/plotly/dash/issues/2891) +- [#2908](https://github.com/plotly/dash/pull/2908) Fix when environment variables are ignored by Dash.run() at runtime. Fixes [#2902](https://github.com/plotly/dash/issues/2902) ## [2.17.1] - 2024-06-12 diff --git a/dash/dash.py b/dash/dash.py index f9cc2139f3..3e5e4e4170 100644 --- a/dash/dash.py +++ b/dash/dash.py @@ -1981,8 +1981,8 @@ def delete_resource(resources): def run( self, - host=None, - port=None, + host="127.0.0.1", + port="8050", proxy=None, debug=None, jupyter_mode: JupyterDisplayMode = None,