Fix Gunicorn worker

This commit is contained in:
messense 2017-05-23 11:28:12 +08:00
parent 3eed81c1eb
commit 6bdc0d2e5e
No known key found for this signature in database
GPG Key ID: BB41A8A2C716CCA9
2 changed files with 6 additions and 5 deletions

View File

@ -543,6 +543,9 @@ class Sanic:
:param protocol: Subclass of asyncio protocol class :param protocol: Subclass of asyncio protocol class
:return: Nothing :return: Nothing
""" """
if sock is None:
host, port = host or "127.0.0.1", port or 8000
if log_config: if log_config:
logging.config.dictConfig(log_config) logging.config.dictConfig(log_config)
if protocol is None: if protocol is None:
@ -590,6 +593,9 @@ class Sanic:
NOTE: This does not support multiprocessing and is not the preferred NOTE: This does not support multiprocessing and is not the preferred
way to run a Sanic application. way to run a Sanic application.
""" """
if sock is None:
host, port = host or "127.0.0.1", port or 8000
if log_config: if log_config:
logging.config.dictConfig(log_config) logging.config.dictConfig(log_config)
if protocol is None: if protocol is None:
@ -635,9 +641,6 @@ class Sanic:
protocol=HttpProtocol, backlog=100, stop_event=None, protocol=HttpProtocol, backlog=100, stop_event=None,
register_sys_signals=True, run_async=False, has_log=True): register_sys_signals=True, run_async=False, has_log=True):
"""Helper function used by `run` and `create_server`.""" """Helper function used by `run` and `create_server`."""
if sock is None:
host, port = host or "127.0.0.1", port or 8000
if isinstance(ssl, dict): if isinstance(ssl, dict):
# try common aliaseses # try common aliaseses
cert = ssl.get('cert') or ssl.get('certificate') cert = ssl.get('cert') or ssl.get('certificate')

View File

@ -48,8 +48,6 @@ class GunicornWorker(base.Worker):
protocol = (WebSocketProtocol if self.app.callable.websocket_enabled protocol = (WebSocketProtocol if self.app.callable.websocket_enabled
else HttpProtocol) else HttpProtocol)
self._server_settings = self.app.callable._helper( self._server_settings = self.app.callable._helper(
host=None,
port=None,
loop=self.loop, loop=self.loop,
debug=is_debug, debug=is_debug,
protocol=protocol, protocol=protocol,