Beispiel #1
0
def wsgi_run(xom, app):
    from waitress import serve
    host = xom.config.args.host
    port = xom.config.args.port
    unix_socket = xom.config.args.unix_socket
    kwargs = dict(threads=xom.config.args.threads,
                  max_request_body_size=xom.config.args.max_request_body_size)
    if unix_socket is not None:
        kwargs['unix_socket'] = unix_socket
        if host == 'localhost':
            host = None
        if port == 3141:
            port = None
    if host or port:
        kwargs['host'] = host
        kwargs['port'] = port
    log = xom.log
    log.info("devpi-server version: %s", server_version)
    log.info("serverdir: %s" % xom.config.serverdir)
    log.info("uuid: %s" % xom.config.nodeinfo["uuid"])
    hostaddr = "http://%s:%s" % (host, port)
    hostaddr6 = "http://[%s]:%s" % (host, port)
    log.info("serving at url: %s (might be %s for IPv6)", hostaddr, hostaddr6)
    log.info("using %s threads", kwargs['threads'])
    log.info("bug tracker: https://github.com/devpi/devpi/issues")
    log.info("IRC: #devpi on irc.freenode.net")
    if "WEBTRACE" in os.environ and xom.config.args.debug:
        from weberror.evalexception import make_eval_exception
        app = make_eval_exception(app, {})
    try:
        log.info("Hit Ctrl-C to quit.")
        serve(app, **kwargs)
    except KeyboardInterrupt:
        pass
    return 0
Beispiel #2
0
def wsgi_run(xom, app):
    from waitress import serve
    host = xom.config.args.host
    port = xom.config.args.port
    threads = xom.config.args.threads
    max_body = xom.config.args.max_request_body_size
    log = xom.log
    log.info("devpi-server version: %s", server_version)
    log.info("serverdir: %s" % xom.config.serverdir)
    log.info("uuid: %s" % xom.config.nodeinfo["uuid"])
    hostaddr = "http://%s:%s" % (host, port)
    hostaddr6 = "http://[%s]:%s" % (host, port)
    log.info("serving at url: %s (might be %s for IPv6)", hostaddr, hostaddr6)
    log.info("using %s threads", threads)
    log.info("bug tracker: https://github.com/devpi/devpi/issues")
    log.info("IRC: #devpi on irc.freenode.net")
    if "WEBTRACE" in os.environ and xom.config.args.debug:
        from weberror.evalexception import make_eval_exception
        app = make_eval_exception(app, {})
    try:
        log.info("Hit Ctrl-C to quit.")
        serve(app,
              host=host,
              port=port,
              threads=threads,
              max_request_body_size=max_body)
    except KeyboardInterrupt:
        pass
    return 0
Beispiel #3
0
def weberror_wrapper(app, global_config, **local_config):
    keys = ['error_email', 'from_address', 'show_exceptions',
            'smtp_server', 'smtp_use_tls', 'smtp_username ',
            'smtp_password ', 'error_subject_prefix',]
    for k in keys:
        if k in local_config:
            del local_config[k]
    return make_eval_exception(app, global_config, **local_config)
Beispiel #4
0
def _app_factory(manager):
    settings = manager.settings
    global_conf = {}
    app_factory = maybe_resolve(manager.app_factory)
    app = app_factory(global_conf, **settings)
    if settings.get('DEBUG', False):
        app = make_eval_exception(app, global_conf,
                                  reporters=[Reporter(manager)])
    else:
        app = make_error_middleware(app, global_conf)

    return app
Beispiel #5
0
def wsgi_run(xom, app):
    from waitress import serve
    host = xom.config.args.host
    port = xom.config.args.port
    log = xom.log
    log.info("devpi-server version: %s", server_version)
    log.info("serverdir: %s" % xom.config.serverdir)
    hostaddr = "http://%s:%s" % (host, port)
    log.info("serving at url: %s", hostaddr)
    log.info("bug tracker: https://bitbucket.org/hpk42/devpi/issues")
    log.info("IRC: #devpi on irc.freenode.net")
    if "WEBTRACE" in os.environ and xom.config.args.debug:
        from weberror.evalexception import make_eval_exception
        app = make_eval_exception(app, {})
    try:
        log.info("Hit Ctrl-C to quit.")
        serve(app, host=host, port=port, threads=50)
    except KeyboardInterrupt:
        pass
    return 0
Beispiel #6
0
def wsgi_run(xom, app):
    from waitress import serve
    host = xom.config.args.host
    port = xom.config.args.port
    log = xom.log
    log.info("devpi-server version: %s", server_version)
    log.info("serverdir: %s" % xom.config.serverdir)
    hostaddr = "http://%s:%s" % (host, port)
    log.info("serving at url: %s", hostaddr)
    log.info("bug tracker: https://bitbucket.org/hpk42/devpi/issues")
    log.info("IRC: #devpi on irc.freenode.net")
    if "WEBTRACE" in os.environ and xom.config.args.debug:
        from weberror.evalexception import make_eval_exception
        app = make_eval_exception(app, {})
    try:
        log.info("Hit Ctrl-C to quit.")
        serve(app, host=host, port=port, threads=50)
    except KeyboardInterrupt:
        pass
    return 0
Beispiel #7
0
def bottle_run(xom):
    import bottle
    app = xom.create_app(immediatetasks=True,
                         catchall=not xom.config.args.debug)
    port = xom.config.args.port
    log.info("devpi-server version: %s", server_version)
    log.info("serverdir: %s" % xom.config.serverdir)
    hostaddr = "http://%s:%s" %(xom.config.args.host, xom.config.args.port)
    log.info("serving at url: %s", hostaddr)
    log.info("bug tracker: https://bitbucket.org/hpk42/devpi/issues")
    log.info("IRC: #devpi on irc.freenode.net")
    if "WEBTRACE" in os.environ and xom.config.args.debug:
        from weberror.evalexception import make_eval_exception
        app = make_eval_exception(app, {})
    bottleserver = get_bottle_server(xom.config.args.bottleserver)
    log.info("bottleserver type: %s" % bottleserver)
    ret = bottle.run(app=app, server=bottleserver,
                  host=xom.config.args.host,
                  reloader=False, port=port)
    xom.shutdown()
    return ret
Beispiel #8
0
def bottle_run(xom):
    import bottle
    app = xom.create_app(immediatetasks=True,
                         catchall=not xom.config.args.debug)
    port = xom.config.args.port
    log.info("devpi-server version: %s", server_version)
    log.info("serverdir: %s" % xom.config.serverdir)
    hostaddr = "http://%s:%s" % (xom.config.args.host, xom.config.args.port)
    log.info("serving at url: %s", hostaddr)
    log.info("bug tracker: https://bitbucket.org/hpk42/devpi/issues")
    log.info("IRC: #devpi on irc.freenode.net")
    if "WEBTRACE" in os.environ and xom.config.args.debug:
        from weberror.evalexception import make_eval_exception
        app = make_eval_exception(app, {})
    bottleserver = get_bottle_server(xom.config.args.bottleserver)
    log.info("bottleserver type: %s" % bottleserver)
    ret = bottle.run(app=app,
                     server=bottleserver,
                     host=xom.config.args.host,
                     reloader=False,
                     port=port)
    xom.shutdown()
    return ret
# The default stuff
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myapp.settings")

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

# then you have to override Django's own debug response
# to let the error keep bubbling
import django.views.debug

def null_technical_500_response(request, exc_type, exc_value, tb):
    raise exc_type, exc_value, tb
django.views.debug.technical_500_response = null_technical_500_response

# and wrap the application in paste's weberror

from weberror.evalexception import make_eval_exception
global_conf = {} # see weberror docs for options...
application = make_eval_exception(application, global_conf)