Beispiel #1
0
    def run(self, *args, **kwargs):
        from gunicorn.app.wsgiapp import WSGIApplication

        app = WSGIApplication()
        app.app_uri = 'lemur:create_app(config="{0}")'.format(kwargs.get('config'))

        return app.run()
Beispiel #2
0
def http(host='127.0.0.1', port=5000, workers=None):
    """Runs the app within Gunicorn."""
    workers = workers or app.config.get('WORKERS') or 1

    if app.debug:
        app.run(host, int(port))
    else:
        gunicorn = WSGIApplication()
        gunicorn.load_wsgiapp = lambda: app
        gunicorn.cfg.set('bind', '%s:%s' % (host, port))
        gunicorn.cfg.set('workers', workers)
        gunicorn.cfg.set('pidfile', None)
        gunicorn.cfg.set('accesslog', '-')
        gunicorn.cfg.set('errorlog', '-')
        gunicorn.chdir()
        gunicorn.run()
Beispiel #3
0
    def run(self, *args, **kwargs):
        from gunicorn.app.wsgiapp import WSGIApplication

        app = WSGIApplication()

        app.app_uri = 'aardvark:create_app()'
        return app.run()
Beispiel #4
0
    def run(self, *args, **kwargs):
        from gunicorn.app.wsgiapp import WSGIApplication

        app = WSGIApplication()
        app.app_uri = 'lemur:create_app(config="{0}")'.format(kwargs.get('config'))

        return app.run()
Beispiel #5
0
def runserver(host='0.0.0.0', port=6000, workers=1):
    """Run the app with Gunicorn."""

    if app.debug:
        app.run(host, int(port), use_reloader=False)
    else:
        gunicorn = WSGIApplication()
        gunicorn.load_wsgiapp = lambda: app
        gunicorn.cfg.set('bind', '%s:%s' % (host, port))
        gunicorn.cfg.set('workers', workers)
        gunicorn.cfg.set('pidfile', None)
        # gunicorn.cfg.set('worker_class', 'gunicorn.workers.ggevent.GeventWorker')
        gunicorn.cfg.set('accesslog', '-')
        gunicorn.cfg.set('errorlog', '-')
        gunicorn.cfg.set('timeout', 300)
        gunicorn.chdir()
        gunicorn.run()
Beispiel #6
0
def runserver(host=None, port=None, workers=None):
    """Runs the app within Gunicorn."""
    host = host or app.config.get('HTTP_HOST') or '0.0.0.0'
    port = port or app.config.get('HTTP_PORT') or 5000
    workers = workers or app.config.get('HTTP_WORKERS') or 1
    use_evalex = app.config.get('USE_EVALEX', app.debug)

    if app.debug:
        app.run(host, int(port), use_evalex=use_evalex)
    else:
        gunicorn = WSGIApplication()
        gunicorn.load_wsgiapp = lambda: app
        gunicorn.cfg.set('bind', '%s:%s' % (host, port))
        gunicorn.cfg.set('workers', workers)
        gunicorn.cfg.set('pidfile', None)
        gunicorn.cfg.set('accesslog', '-')
        gunicorn.cfg.set('errorlog', '-')
        gunicorn.chdir()
        gunicorn.run()
def runserver(ctx, bind=None, develop=False):
    """Start Admin server."""
    if bind:
        host, port = bind.split(':')
    else:
        host, port = settings.admin.host, settings.admin.port

    if develop:
        executable = 'gunicorn'

        args = [executable, 'admin.app:app']
        args += ['-b', '{}:{}'.format(host, port)]
        args += ['--timeout', '600']
        args += ['--reload']

        g_app = WSGIApplication()
        g_app.run()
    else:
        app.run(debug=settings.debug, host=host, port=int(port))
        return
Beispiel #8
0
    def run(self, *args, **kwargs):
        from gunicorn.app.wsgiapp import WSGIApplication

        app = WSGIApplication()

        # run startup tasks on an app like object
        validate_conf(current_app, REQUIRED_VARIABLES)

        app.app_uri = 'lemur:create_app(config="{0}")'.format(current_app.config.get('CONFIG_PATH'))

        return app.run()
Beispiel #9
0
    def run(self, *args, **kwargs):
        from gunicorn.app.wsgiapp import WSGIApplication

        app = WSGIApplication()

        # run startup tasks on an app like object
        validate_conf(current_app, REQUIRED_VARIABLES)

        app.app_uri = 'lemur:create_app(config="{0}")'.format(current_app.config.get('CONFIG_PATH'))

        return app.run()
Beispiel #10
0
    def run(self, *args, **kwargs):
        from gunicorn.app.wsgiapp import WSGIApplication

        app = WSGIApplication()

        # run startup tasks on a app like object
        pre_app = create_app(kwargs.get('config'))
        validate_conf(pre_app, REQUIRED_VARIABLES)

        app.app_uri = 'lemur:create_app(config="{0}")'.format(
            kwargs.get('config'))

        return app.run()
Beispiel #11
0
    def run(self, *args, **kwargs):
        from gunicorn.app.wsgiapp import WSGIApplication

        app = WSGIApplication()

        # run startup tasks on an app like object
        validate_conf(current_app, REQUIRED_VARIABLES)

        app.app_uri = 'lemur:create_app(config_path="{0}")'.format(
            current_app.config.get("CONFIG_PATH"))

        log_config_dict = current_app.config.get("LOG_CONFIG_DICT")
        if log_config_dict:
            app.cfg.set("logconfig_dict", log_config_dict)

        return app.run()
Beispiel #12
0
def deploy():
    """
    Deploy app
    """
    app.config.update(DEBUG=False, TESTING=False)

    try:
        os.mkdir("log")
    except BaseException:
        pass

    for file_name in ["log/error.log", "log/access.log"]:
        if not os.path.exists(file_name):
            os.system("touch " + file_name)

    from gunicorn.app.wsgiapp import WSGIApplication
    guni_app = WSGIApplication()
    guni_app.app_uri = 'dueros:app'

    options = {
        'workers': 4,
        'accesslog': 'log/access.log',
        'errorlog': 'log/error.log',
        'loglevel': 'info',
        'bind': '127.0.0.1:8000',
    }

    config = dict([(key, value) for key, value in iteritems(options)])

    for key, value in iteritems(config):
        guni_app.cfg.set(key, value)

    print(
        "=======================================================================\n"
        "============================ start gunicorn ===========================\n"
        "======================================================================="
    )
    return guni_app.run()
Beispiel #13
0
def run_app(_args):
    from gunicorn.app.wsgiapp import WSGIApplication
    wsgi_app = WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]")
    wsgi_app.app_uri = 'gam.app:create_app()'
    wsgi_app.cfg.set('reload', True)
    wsgi_app.run()
Beispiel #14
0
 def run(self, *args, **kwargs):
     from gunicorn.app.wsgiapp import WSGIApplication
     app = WSGIApplication()
     app.app_uri = 'manage:app'
     return app.run()
from gunicorn.app.wsgiapp import WSGIApplication

w = WSGIApplication()
w.run()
Beispiel #16
0
#!/usr/bin/env python
from gunicorn.app.wsgiapp import WSGIApplication

# --bind 0.0.0.0:8080 -w 1 -k uvicorn.workers.UvicornWorker -t 600 ranker.server:APP
app = WSGIApplication()

app.run()
# coding: utf-8
import sys
from gunicorn.app.wsgiapp import WSGIApplication

__author__ = 'banxi'

if __name__ == '__main__':
    app = WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]")
    sys.exit(app.run())
    def run(self, *args, **kwargs):
        from gunicorn.app.wsgiapp import WSGIApplication

        app = WSGIApplication()
        app.app_uri = 'moonlighter:app'
        return app.run()
Beispiel #19
0
 def start_webserver(self):
     app = WSGIApplication()
     app.app_uri = 'cerberus.webserver:app'
     return app.run()