Switch from Paste for serving to Waitress

Incredibly, it looks like none of our documentation has to change taking
this route...!
This commit is contained in:
Christopher Allan Webber
2016-02-17 17:39:32 -08:00
parent 149f46f7d5
commit d61778a489
6 changed files with 17 additions and 85 deletions

View File

@@ -365,34 +365,3 @@ def paste_app_factory(global_config, **app_config):
mgoblin_app = hook_transform('wrap_wsgi', mgoblin_app)
return mgoblin_app
def paste_server_selector(wsgi_app, global_config=None, **app_config):
"""
Select between gunicorn and paste depending on what ia available
"""
# See if we can import the gunicorn server...
# otherwise we'll use the paste server
try:
import gunicorn
except ImportError:
gunicorn = None
if gunicorn is None:
# use paste
from paste.httpserver import server_runner
cleaned_app_config = dict(
[(key, app_config[key])
for key in app_config
if key in ["host", "port", "handler", "ssl_pem", "ssl_context",
"server_version", "protocol_version", "start_loop",
"daemon_threads", "socket_timeout", "use_threadpool",
"threadpool_workers", "threadpool_options",
"request_queue_size"]])
return server_runner(wsgi_app, global_config, **cleaned_app_config)
else:
# use gunicorn
from gunicorn.app.pasterapp import PasterServerApplication
return PasterServerApplication(wsgi_app, global_config, **app_config)

View File

@@ -29,7 +29,6 @@ class ServeCommand(object):
return loadapp(app_spec, name=name, relative_to=relative_to, **kwargs)
def daemonize(self):
# TODO: pass to gunicorn if available
pass
def restart_with_reloader(self):

View File

@@ -13,6 +13,6 @@ config = %(here)s/mediagoblin.ini
CELERY_ALWAYS_EAGER = true
[server:main]
use = egg:gunicorn
use = egg:waitress#main
host = 127.0.0.1
port = 6543