Skip to content

Commit

Permalink
Use dynamic port range if no port specified.
Browse files Browse the repository at this point in the history
  • Loading branch information
T4rk1n committed Apr 11, 2022
1 parent 3884843 commit 77984d1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion dash/testing/application_runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ def import_app(app_file, application_name="app"):
class BaseDashRunner:
"""Base context manager class for running applications."""

_next_port = 58050

def __init__(self, keep_open, stop_timeout):
self.port = 8050
self.started = None
Expand Down Expand Up @@ -148,7 +150,8 @@ def run():
app.scripts.config.serve_locally = True
app.css.config.serve_locally = True
if "port" not in kwargs:
kwargs["port"] = self.port
kwargs["port"] = self.port = BaseDashRunner._next_port
BaseDashRunner._next_port += 1
else:
self.port = kwargs["port"]

Expand Down

0 comments on commit 77984d1

Please sign in to comment.