What is the Python 3 equivalent of python -m SimpleHTTPServer
?
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Django __str__ returned non-string (type NoneType)
- Evil ctypes hack in python
The equivalent is:
The command
python -m SimpleHTTPServer
is for Linux. Use Commandpython -m http.server 7777
for WindowsUsing 2to3 utility.
In one of my projects I run tests against Python 2 and 3. For that I wrote a small script which starts a local server independently:
As an alias:
Please note that I control my Python version via conda environments, because of that I can use
python
instead ofpython3
for using Python 3.From the docs:
So, your command is
python3 -m http.server
.In addition to Petr's answer, if you want to bind to a specific interface instead of all the interfaces you can use -b/--bind flag.
The above snippet should do the trick. 8000 is the port number. 80 is used as the standard port for HTTP communications.