diff --git a/docs/deployment.md b/docs/deployment.md index 65163b526..b7c2e6fab 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, 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 300a318f6..e2ec3d866 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, 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 95e62a41c..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.", + 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.")