Exemplo n.º 1
0
 def motor(app, address, **options):
     #https://github.com/rpedroso/motor
     import motor
     app = motor.WSGIContainer(app)
     http_server = motor.HTTPServer(app)
     http_server.listen(address=address[0], port=address[1])
     #http_server.start(2)
     motor.IOLoop.instance().start()
Exemplo n.º 2
0
import motor


def simple_app(environ, start_response):
    status = '200 OK'
    message = "You requested %s\n" % environ['PATH_INFO']

    headers = [
        ("Connection", "keep-alive"),
    ]

    start_response(status, headers)

    ret = (message, )
    return ret


if __name__ == '__main__':
    app = motor.WSGIContainer(simple_app)
    http_server = motor.HTTPServer(app)
    http_server.bind(8888)
    http_server.start(2)
    motor.IOLoop.instance().start()