def wsgi_server(host, port, workers, timeout): wsgi_app = WSGIApplication() wsgi_app.load_wsgiapp = lambda: app wsgi_app.cfg.set('bind', '%s:%s' % (host, port)) wsgi_app.cfg.set('workers', workers) wsgi_app.cfg.set('timeout', timeout) wsgi_app.cfg.set('pidfile', None) wsgi_app.cfg.set('accesslog', '-') wsgi_app.cfg.set('errorlog', '-') wsgi_app.chdir() wsgi_app.run()
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()
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()
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()