How to use the wsgiref.simple_server.make_server function in wsgiref

To help you get started, we’ve selected a few wsgiref examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github google / grr / grr / gui / runtests.py View on Github external
def run(self):
    """Run the django server in a thread."""
    logging.info("Base URL is %s", self.base_url)
    port = self.port
    logging.info("Django listening on port %d.", port)
    try:
      # Make a simple reference implementation WSGI server
      server = simple_server.make_server("0.0.0.0", port,
                                         django_lib.GetWSGIHandler())
    except socket.error as e:
      raise socket.error("Error while listening on port %d: %s." %
                         (port, str(e)))

    # We want to notify other threads that we are now ready to serve right
    # before we enter the serving loop.
    self.ready_to_serve.set()
    while self.keep_running:
      server.handle_request()
github GMOD / jbrowse / tests / selenium_tests / name_server.py View on Github external
def start_server():
    httpd = make_server('localhost', 8051, application)
    httpd.serve_forever()
github Pylons / pyramid_tutorials / humans / resources / step04 / application.py View on Github external
from pyramid.config import Configurator

from resources import bootstrap


def main():
    config = Configurator(root_factory=bootstrap)
    config.include('pyramid_chameleon')
    config.scan("views")
    app = config.make_wsgi_app()
    return app


if __name__ == '__main__':
    app = main()
    server = make_server(host='0.0.0.0', port=8080, app=app)
    server.serve_forever()
github toscawidgets / tw2.forms / examples / elixir.py View on Github external
class child(twf.TableLayout):
            id = twf.HiddenField()
            name = twf.TextField()
            status_id = twf.SingleSelectField(options=[str(r) for r in Status.query.all()])
            customer_id = twf.SingleSelectField(options=[str(r) for r in People.query.all()])
            assignee_id = twf.SingleSelectField(options=[str(r) for r in People.query.all()])
            delivery = twf.CheckBox()
            address = twf.TextArea()

    def fetch_data(self, req):
        self.value = Order.query.get(req.GET['id'])


if __name__ == '__main__':
    import wsgiref.simple_server as wrs
    wrs.make_server('', 8000, twc.make_middleware(controller_prefix='/')).serve_forever()
github nortd / driveboardapp / backend / bottle.py View on Github external
def run(self, handler): # pragma: no cover
        from wsgiref.simple_server import make_server, WSGIRequestHandler
        if self.quiet:
            class QuietHandler(WSGIRequestHandler):
                def log_request(*args, **kw): pass
            self.options['handler_class'] = QuietHandler
        srv = make_server(self.host, self.port, handler, **self.options)
        srv.serve_forever()
github laurentb / weboob / weboob / frontends / videoob_web / videoob_web.py View on Github external
def main(self, argv):
        self.load_config()
        self.weboob.load_modules(ICapVideo)
        print 'Web server created. Listening on http://%s:%s' % (
            self.config.get('host'), int(self.config.get('port')))
        srv = make_server(self.config.get('host'), int(self.config.get('port')), self.make_app)
        srv.serve_forever()
github dragondjf / CloudSetuper / setuper web app / main.py View on Github external
def main():
    tornado.options.parse_command_line()
    app = Application()
    if options.server == "tornado":
        logging.info("Server is %s" % options.server)
        app.listen(options.port)
        tornado.ioloop.IOLoop.instance().start()
    elif options.server == "wsgiref":
        logging.info("Server is %s" % options.server)
        wsgi_app = tornado.wsgi.WSGIAdapter(app)
        server = wsgiref.simple_server.make_server('', options.port, wsgi_app)
        server.serve_forever()
github douban / sina / examples / run_wsgiref.py View on Github external
# -*- coding: utf-8 -*-

from wsgiref.simple_server import make_server
from sina import Sina
from sina.config import DEFAULT_CONFIG


if __name__ == '__main__':
    DEFAULT_CONFIG['chunked'] = True
    app = Sina(DEFAULT_CONFIG)
    server = make_server('0.0.0.0', 8000, app)
    server.serve_forever()
github cloudendpoints / esp / docker / serverless / env-start-esp.py View on Github external
def serve_error_msg(error_msg):
    print("Serving error handler with '{}'.".format(error_msg))
    import wsgiref.simple_server

    app = make_error_app(error_msg)
    port = int(os.environ["PORT"])
    server = wsgiref.simple_server.make_server("", port, app)
    server.serve_forever()