def start_serving(self): if not self.may_serve: return if USE_TORNADO: MainHandler.start_serving() else: thread = threading.Thread(target=self.server.serve_forever) thread.deamon = True thread.start()
def init_server(self): if USE_TORNADO: MainHandler.init_server(PORT, LIFESPAN) else: print(""" ************* WARNING: Using the python's built-in BaseHTTPServer! It is all right if you run the tests on your local machine, but if you are running tests on a server, please consider installing Tornado. It is a much more powerful web-server. Otherwise you will find that some of your downloader tests either fail or hang. do sudo pip install tornado or go to http://www.tornadoweb.org/en/stable/ for more detail. ************* """) self.server = InternalServer(('localhost', PORT), PostHandler)