Exemple #1
0
def main(config=None, wiki=None):
    """Start a standalone WSGI server."""

    config = config or read_config()
    wiki = wiki or Wiki(config)
    app = wiki.application

    host, port = (config.get('interface',
                             '0.0.0.0'), int(config.get('port', 8080)))
    try:
        from cherrypy import wsgiserver
    except ImportError:
        try:
            from cherrypy import _cpwsgiserver as wsgiserver
        except ImportError:
            import wsgiref.simple_server
            server = wsgiref.simple_server.make_server(host, port, app)
            try:
                server.serve_forever()
            except KeyboardInterrupt:
                pass
            return
    name = wiki.site_name
    server = wsgiserver.CherryPyWSGIServer((host, port), app, server_name=name)
    try:
        server.start()
    except KeyboardInterrupt:
        server.stop()
Exemple #2
0
def main(config=None, wiki=None):
    """Start a standalone WSGI server."""

    config = config or read_config()
    wiki = wiki or Wiki(config)
    app = wiki.application

    host, port = (config.get('interface', '0.0.0.0'),
                  int(config.get('port', 8080)))
    try:
        from cherrypy import wsgiserver
    except ImportError:
        try:
            from cherrypy import _cpwsgiserver as wsgiserver
        except ImportError:
            import wsgiref.simple_server
            server = wsgiref.simple_server.make_server(host, port, app)
            try:
                server.serve_forever()
            except KeyboardInterrupt:
                pass
            return
    name = wiki.site_name
    server = wsgiserver.CherryPyWSGIServer((host, port), app,
                                           server_name=name)
    try:
        server.start()
    except KeyboardInterrupt:
        server.stop()
Exemple #3
0
def application(env, start):
    """Detect that we are being run as WSGI application."""

    global application
    config = read_config()
    script_dir = os.path.dirname(os.path.abspath(__file__))
    if config.get('pages_path') is None:
        config.set('pages_path', os.path.join(script_dir, 'docs'))
    wiki = Wiki(config)
    application = wiki.application
    return application(env, start)
Exemple #4
0
def application(env, start):
    """Detect that we are being run as WSGI application."""

    global application
    config = read_config()
    script_dir = os.path.dirname(os.path.abspath(__file__))
    if config.get('pages_path') is None:
        config.set('pages_path', os.path.join(script_dir, 'docs'))
    wiki = Wiki(config)
    application = wiki.application
    return application(env, start)
Exemple #5
0
def main(config=None, wiki=None):
    """Start a standalone WSGI server."""

    config = config or read_config()
    wiki = wiki or Wiki(config)
    app = wiki.application

    host, port = (config.get('interface',
                             '0.0.0.0'), int(config.get('port', 8080)))
    try:
        from cheroot import wsgi
    except ImportError:
        import werkzeug
        try:
            werkzeug.run_simple(host, port, app, use_reloader=False)
        except KeyboardInterrupt:
            pass
    else:
        name = wiki.site_name
        server = wsgi.Server((host, port), app, server_name=name)
        try:
            server.start()
        except KeyboardInterrupt:
            server.stop()