Python - BaseHTTPServer.HTTPServer Concurrency & Threading

你说的曾经没有我的故事 提交于 2019-11-29 17:25:38

问题


Is there a way to make BaseHTTPServer.HTTPServer be multi-threaded like SocketServer.ThreadingTCPServer?


回答1:


You can simply use the threading mixin using both of those classes to make it multithread :)

It won't help you much in performance though, but it's atleast multithreaded.

from SocketServer import ThreadingMixIn
from BaseHTTPServer import HTTPServer

class MultiThreadedHTTPServer(ThreadingMixIn, HTTPServer):
    pass


来源:https://stackoverflow.com/questions/2398144/python-basehttpserver-httpserver-concurrency-threading

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!