What is the Python 3 equivalent of “python -m SimpleHTTPServer”

后端 未结 6 713
萌比男神i
萌比男神i 2020-11-28 00:19

What is the Python 3 equivalent of python -m SimpleHTTPServer?

6条回答
  •  迷失自我
    2020-11-28 00:36

    In addition to Petr's answer, if you want to bind to a specific interface instead of all the interfaces you can use -b or --bind flag.

    python -m http.server 8000 --bind 127.0.0.1
    

    The above snippet should do the trick. 8000 is the port number. 80 is used as the standard port for HTTP communications.

提交回复
热议问题