From ac26ab3dfaacb61de041857151596c5b661b6691 Mon Sep 17 00:00:00 2001 From: Hiroshiba Date: Sat, 27 May 2023 16:19:26 +0900 Subject: [PATCH 1/3] add `If 0, a random port is used.` --- docs/index.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/index.md b/docs/index.md index 300a318f6..8f76dd711 100644 --- a/docs/index.md +++ b/docs/index.md @@ -100,7 +100,8 @@ Usage: uvicorn [OPTIONS] APP Options: --host TEXT Bind socket to this host. [default: 127.0.0.1] - --port INTEGER Bind socket to this port. [default: 8000] + --port INTEGER Bind socket to this port. If 0, a random + port is used. [default: 8000] --uds TEXT Bind to a UNIX domain socket. --fd INTEGER Bind to socket from this file descriptor. --reload Enable auto-reload. From e90e16d5093e998eacc44e6eff474a2d6bc4e4e8 Mon Sep 17 00:00:00 2001 From: Hiroshiba Date: Mon, 29 May 2023 20:08:54 +0000 Subject: [PATCH 2/3] modify main.py --- docs/deployment.md | 3 ++- uvicorn/main.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/deployment.md b/docs/deployment.md index 65163b526..92cc39a9c 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -33,7 +33,8 @@ Usage: uvicorn [OPTIONS] APP Options: --host TEXT Bind socket to this host. [default: 127.0.0.1] - --port INTEGER Bind socket to this port. [default: 8000] + --port INTEGER Bind socket to this port. If 0, a random + port is used. [default: 8000] --uds TEXT Bind to a UNIX domain socket. --fd INTEGER Bind to socket from this file descriptor. --reload Enable auto-reload. diff --git a/uvicorn/main.py b/uvicorn/main.py index 95e62a41c..631c0d392 100644 --- a/uvicorn/main.py +++ b/uvicorn/main.py @@ -71,7 +71,7 @@ def print_version(ctx: click.Context, param: click.Parameter, value: bool) -> No "--port", type=int, default=8000, - help="Bind socket to this port.", + help="Bind socket to this port. If 0, a random port is used.", show_default=True, ) @click.option("--uds", type=str, default=None, help="Bind to a UNIX domain socket.") From 888012885da793ce738e8f91238c892018c8737a Mon Sep 17 00:00:00 2001 From: Hiroshiba Date: Tue, 30 May 2023 19:36:37 +0000 Subject: [PATCH 3/3] If 0, an available port will be picked. --- docs/deployment.md | 4 ++-- docs/index.md | 4 ++-- uvicorn/main.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/deployment.md b/docs/deployment.md index 92cc39a9c..b7c2e6fab 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -33,8 +33,8 @@ Usage: uvicorn [OPTIONS] APP Options: --host TEXT Bind socket to this host. [default: 127.0.0.1] - --port INTEGER Bind socket to this port. If 0, a random - port is used. [default: 8000] + --port INTEGER Bind socket to this port. If 0, an available + port will be picked. [default: 8000] --uds TEXT Bind to a UNIX domain socket. --fd INTEGER Bind to socket from this file descriptor. --reload Enable auto-reload. diff --git a/docs/index.md b/docs/index.md index 8f76dd711..e2ec3d866 100644 --- a/docs/index.md +++ b/docs/index.md @@ -100,8 +100,8 @@ Usage: uvicorn [OPTIONS] APP Options: --host TEXT Bind socket to this host. [default: 127.0.0.1] - --port INTEGER Bind socket to this port. If 0, a random - port is used. [default: 8000] + --port INTEGER Bind socket to this port. If 0, an available + port will be picked. [default: 8000] --uds TEXT Bind to a UNIX domain socket. --fd INTEGER Bind to socket from this file descriptor. --reload Enable auto-reload. diff --git a/uvicorn/main.py b/uvicorn/main.py index 631c0d392..d4fe3bbf4 100644 --- a/uvicorn/main.py +++ b/uvicorn/main.py @@ -71,7 +71,7 @@ def print_version(ctx: click.Context, param: click.Parameter, value: bool) -> No "--port", type=int, default=8000, - help="Bind socket to this port. If 0, a random port is used.", + help="Bind socket to this port. If 0, an available port will be picked.", show_default=True, ) @click.option("--uds", type=str, default=None, help="Bind to a UNIX domain socket.")