@@ -412,32 +412,37 @@ the current directory::
412
412
.. _http-server-cli :
413
413
414
414
:mod: `http.server ` can also be invoked directly using the :option: `-m `
415
- switch of the interpreter with a `` port number `` argument . Similar to
415
+ switch of the interpreter. Similar to
416
416
the previous example, this serves files relative to the current directory::
417
417
418
- python -m http.server 8000
418
+ python -m http.server
419
419
420
- By default, server binds itself to all interfaces. The option ``-b/--bind ``
420
+ The server listens to port 8000 by default. The default can be overridden
421
+ by passing the desired port number as an argument::
422
+
423
+ python -m http.server 9000
424
+
425
+ By default, the server binds itself to all interfaces. The option ``-b/--bind ``
421
426
specifies a specific address to which it should bind. Both IPv4 and IPv6
422
427
addresses are supported. For example, the following command causes the server
423
428
to bind to localhost only::
424
429
425
- python -m http.server 8000 --bind 127.0.0.1
430
+ python -m http.server --bind 127.0.0.1
426
431
427
432
.. versionadded :: 3.4
428
433
``--bind `` argument was introduced.
429
434
430
435
.. versionadded :: 3.8
431
436
``--bind `` argument enhanced to support IPv6
432
437
433
- By default, server uses the current directory. The option ``-d/--directory ``
438
+ By default, the server uses the current directory. The option ``-d/--directory ``
434
439
specifies a directory to which it should serve the files. For example,
435
440
the following command uses a specific directory::
436
441
437
442
python -m http.server --directory /tmp/
438
443
439
444
.. versionadded :: 3.7
440
- ``--directory `` specify alternate directory
445
+ ``--directory `` argument was introduced.
441
446
442
447
.. class :: CGIHTTPRequestHandler(request, client_address, server)
443
448
@@ -482,4 +487,4 @@ the following command uses a specific directory::
482
487
:class: `CGIHTTPRequestHandler ` can be enabled in the command line by passing
483
488
the ``--cgi `` option::
484
489
485
- python -m http.server --cgi 8000
490
+ python -m http.server --cgi
0 commit comments