python 简单的Web服务器

  • 关于CGIGHTTPServer:
  • 基于python3 新建一个webServiceFile
  • 新建一个html.index ,内容随意
  • 新建一个pythonService.py
from http.server import HTTPServer, CGIHTTPRequestHandel 
prot = 4419  #随意自定义,如果放服务器的话,记着放开端口
htpp = HTTPServer(('',port),CGIHTTPRequestHandel )
http.serve_forever()
  • 调用时
 python3  pythonService.py  
  • 一个简单的web服务器就搭建起来了
  • 附截图

评论