我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用http.server.HTTPServer.serve_forever()。
def serve_forever(self): self.shutdown_signal = False try: if os.environ.get('WERKZEUG_RUN_MAIN') != 'true': display_hostname = self.host != '*' and self.host or 'localhost' if ':' in display_hostname: display_hostname = '[%s]' % display_hostname quit_msg = '(Press CTRL+C to quit)' _log('info', ' * Running on %s://%s:%d/ %s', self.ssl_context is None and 'http' or 'https', display_hostname, self.port, quit_msg) HTTPServer.serve_forever(self) except KeyboardInterrupt: pass finally: self.server_close()
def serve_forever(self): self.shutdown_signal = False try: HTTPServer.serve_forever(self) except KeyboardInterrupt: pass finally: self.server_close()
def serve_forever(self): self.shutdown_signal = False try: HTTPServer.serve_forever(self) except KeyboardInterrupt: pass