python自帶web服務器

1、安裝python3,並添加到path中

2、命令中執行: python -m http.server 8000   

說明:服務器文件顯示是執行命令行所在的目錄

(如上顯示爲~目錄下的文件)

3、-b/--bind指定訪問IP地址(支持ipv4和ipv6)

python -m http.server 8000 --bind 127.0.0.1

--bind 127.0.0.1:只有本機可以訪問

4、-d/--directory 指定訪問目錄

python -m http.server --directory /tmp/
--directory /tmp/:訪問/tmp/目錄下文件

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章