Dav*_*ope 56
python3 -m http.server
Run Code Online (Sandbox Code Playgroud)
或者如果您不想使用默认端口8000
python3 -m http.server 3333
Run Code Online (Sandbox Code Playgroud)
或者如果您只想允许来自localhost的连接
python3 -m http.server --bind 127.0.0.1
Run Code Online (Sandbox Code Playgroud)
查看文档.
等效的Python 2命令是
python -m SimpleHTTPServer
python -m SimpleHTTPServer 3333
Run Code Online (Sandbox Code Playgroud)
没有--bind选择.
请参阅Python 2文档.
如果您的服务器文件没有更改,一旦您编辑并保存它们,请键入refresh您的python控制台.这将更新服务器提供的文件和最新的文件.
Ble*_*der 12
对于Node,有http-server:
$ npm install -g http-server
$ http-server Downloads -a localhost -p 8080
Starting up http-server, serving Downloads on port: 8080
Hit CTRL-C to stop the server
Run Code Online (Sandbox Code Playgroud)
Python有:
python -m http.server --bind 127.0.0.1 8080python -m SimpleHTTPServer 8080请注意,Python 2没有--bind选项,因此它将允许所有连接(不仅仅是来自localhost).