def main(args=None): from quixote.server.util import get_server_parser if args is None: args = sys.argv[1:] parser = get_server_parser(run.__doc__) (options, args) = parser.parse_args(args=args) run(import_object(options.factory), host=options.host, port=options.port)
def main(): parser = get_server_parser(MAIN_DOC) parser.add_option('--thread', dest='thread', action='store_true', help=THREAD_HELP) options = parser.parse_args()[0] factory = import_object(options.factory) if options.thread: run_multithreaded(factory, host=options.host, port=options.port) else: run(factory, host=options.host, port=options.port)
def main(): parser = get_server_parser(DESCRIPTION) parser.set_usage(USAGE) parser.remove_option('--factory') opts, args = parser.parse_args() if len(args) != 1: parser.error("wrong number of command-line args") factory_name = "use_" + args[0] try: factory = globals()[factory_name] except KeyError: parser.error("unknown storage type") simple_server.run(factory, opts.host, opts.port)
def main(args=None): from quixote.server.util import get_server_parser if args is None: args = sys.argv[1:] parser = get_server_parser(run.__doc__) parser.add_option( '--https', dest="https", default=False, action="store_true", help=("Force the scheme for all requests to be https. " "Not that this is for running the simple server " "through a proxy or tunnel that provides real SSL " "support. The simple server itself does not. ")) (options, args) = parser.parse_args(args=args) run(import_object(options.factory), host=options.host, port=options.port, https=options.https)
return self.process(self.get_cgi_env('GET')) def run(create_publisher, host='', port=80, https=False): """Runs a simple, single threaded, synchronous HTTP server that publishes a Quixote application. """ if https: HTTPRequestHandler.required_cgi_environment['HTTPS'] = 'on' httpd = HTTPServer((host, port), HTTPRequestHandler) publisher = create_publisher() httpd.serve_forever() if __name__ == '__main__': from quixote.server.util import get_server_parser parser = get_server_parser(run.__doc__) parser.add_option('--https', dest="https", default=False, action="store_true", help=("Force the scheme for all requests to be https. " "Not that this is for running the simple server " "through a proxy or tunnel that provides real SSL " "support. The simple server itself does not. ")) (options, args) = parser.parse_args() run(import_object(options.factory), host=options.host, port=options.port, https=options.https)
def do_POST(self): return self.process(self.get_cgi_env('POST')) def do_GET(self): return self.process(self.get_cgi_env('GET')) def run(create_publisher, host='', port=80, https=False): """Runs a simple, single threaded, synchronous HTTP server that publishes a Quixote application. """ if https: HTTPRequestHandler.required_cgi_environment['HTTPS'] = 'on' httpd = HTTPServer((host, port), HTTPRequestHandler) publisher = create_publisher() httpd.serve_forever() if __name__ == '__main__': from quixote.server.util import get_server_parser parser = get_server_parser(run.__doc__) parser.add_option( '--https', dest="https", default=False, action="store_true", help=("Force the scheme for all requests to be https. " "Not that this is for running the simple server " "through a proxy or tunnel that provides real SSL " "support. The simple server itself does not. ")) (options, args) = parser.parse_args() run(import_object(options.factory), host=options.host, port=options.port, https=options.https)