@@ -35,7 +35,7 @@ To build a classical Sphinx documentation set, run:
3535
3636 sphinx-autobuild docs docs/_build/html
3737
38- This will start a server at http://127.0.0.1:8000
38+ This will start a server at http://127.0.0.1:8000 (or automatically find a free port if 8000 is in use)
3939and start watching for changes in the ``docs/ `` directory.
4040When a change is detected in ``docs/ ``, the documentation is rebuilt
4141and any open browser windows are reloaded automatically.
@@ -57,7 +57,7 @@ which can seen by running ``sphinx-autobuild --help``:
5757 ...
5858
5959 autobuild options:
60- --port PORT port to serve documentation on. 0 means find and use a free port
60+ --port PORT port to serve documentation on (defaults to 8000, or a free port if 8000 is in use)
6161 --host HOST hostname to serve documentation on
6262 --re-ignore RE_IGNORE
6363 regular expression for files to ignore, when watching for changes
@@ -101,9 +101,14 @@ Passing ``--open-browser`` will enable this behaviour.
101101Automatically selecting a port
102102------------------------------
103103
104- sphinx-autobuild asks the operating system for a free port number
105- and use that for its server.
106- Passing ``--port=0 `` will enable this behaviour.
104+ By default, sphinx-autobuild tries to use port 8000.
105+ If port 8000 is already in use, it will automatically find and use a free port instead.
106+
107+ You can explicitly request a specific port with ``--port N `` (e.g., ``--port 3000 ``).
108+ If that port is unavailable, sphinx-autobuild will exit with an error.
109+
110+ To always use an automatically-selected free port (skipping the 8000 default),
111+ pass ``--port 0 ``.
107112
108113
109114Workflow suggestions
0 commit comments