python快速搭建本地服务器

1.在cmd中查看 http.server用法

python -m http.server -h

usage: server.py [-h] [–cgi] [–bind ADDRESS] [–directory DIRECTORY] [port]

positional arguments:
port specify alternate port (default: 8000)

options:
-h, --help show this help message and exit
–cgi run as CGI server
–bind ADDRESS, -b ADDRESS
specify alternate bind address (default: all interfaces)
–directory DIRECTORY, -d DIRECTORY
specify alternate directory (default: current directory)
2.在cmd中运行

python -m http.server -d D:\

3.在浏览器中访问
本机电脑输入127.0.0.1:8000
其他在这台电脑一个局域网中设备输入开启服务器这台电脑的ip:8000
文件传输速度测试为9m/s

你可能感兴趣的:(服务器,网络,python)