windows下 python 怎么搭建web服务器
回答数:
1
提问时间:
2020-11-19 23:14:20

用户回答

能源链-孙航
回答时间:2020-11-19 23:28:44
python创建一个最简单http webserver服务器的回方法:答
import sys
import BaseHTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
Handler = SimpleHTTPRequestHandler
Server = BaseHTTPServer.HTTPServer
Protocol = "HTTP/1.0"
if sys.argv[1:]:
port = int(sys.argv[1])
else:
port = 8000
server_address = ('127.0.0.1', port)
Handler.protocol_version = Protocol
httpd = Server(server_address, Handler)
print("Serving HTTP")
httpd.serve_forever()本回答由提问者推荐
  • 相关视频

    Copyright © 2019-2020 懂视生活 51dongshi.com 版权所有

    湘ICP备19013665号-5 违法及侵权请联系:TEL:0731-84117792 E-MAIL:11247931@qq.com