我正在寻找一个非常简单的垃圾箱,我可以在 shell 中启动它并让它为当前目录提供服务(最好不是..),也许还有一个-p
用于指定端口。由于它应该是一个开发服务器,因此默认情况下它应该仅允许来自本地主机的连接,也许可以选择其他方式指定。越简单越好。
不确定在这里使用哪些标签。
python3 -m http.server
或者如果您不想使用默认端口 8000
python3 -m http.server 3333
或者如果您只想允许来自本地主机的连接
python3 -m http.server --bind 127.0.0.1
See the docs https://docs.python.org/3/library/http.server.html#module-http.server.
等效的 Python 2 命令是
python -m SimpleHTTPServer
python -m SimpleHTTPServer 3333
没有--bind
option.
See the Python 2 文档 https://docs.python.org/3/library/http.server.html#module-http.server.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)