Example #1
0
def main():
    try:
        log.debug('Start')
        server_sock = guv.listen(('0.0.0.0', 8001))
        server = guv.server.Server(server_sock, handle, None, None)
        server.start()
    except (SystemExit, KeyboardInterrupt):
        log.debug('Bye!')
Example #2
0
def main():
    try:
        log.debug('Start')
        server_sock = guv.listen(('0.0.0.0', 8001))
        server = guv.server.Server(server_sock, handle, None, None)
        server.start()
    except (SystemExit, KeyboardInterrupt):
        log.debug('Bye!')
Example #3
0
def server_sock():
    sock = listen(('', 0))
    return sock
Example #4
0
import guv
guv.monkey_patch()

import guv.wsgi
import logger

logger.configure()


def app(environ, start_response):
    """
    This is very basic WSGI app useful for testing the performance of guv and guv.wsgi without
    the overhead of a framework such as Flask. However, it can just as easily be any other WSGI app
    callable object, such as a Flask or Bottle app.
    """
    status = '200 OK'
    output = [b'Hello World!']
    content_length = str(len(b''.join(output)))

    response_headers = [('Content-type', 'text/plain'),
                        ('Content-Length', content_length)]

    start_response(status, response_headers)

    return output


if __name__ == '__main__':
    server_sock = guv.listen(('0.0.0.0', 8001))
    guv.wsgi.serve(server_sock, app)