class AppHTTPServer(SocketServer.ThreadingMixIn, BaseHTTPServer.HTTPServer):

    def serve_forever(self):
        self.stop_serving = False
while not self.stop_serving:
    self.handle_request()

def stop(self):
    self.stop_serving = True
Запуск веб-сервера Python как службы в Windows