Skip to content

Commit

Permalink
fix #1167: Allow listening to unix socket for gunicorn server adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
defnull committed Dec 8, 2019
1 parent 07cce60 commit 4164c3f
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions bottle.py
Original file line number Diff line number Diff line change
Expand Up @@ -3448,7 +3448,11 @@ class GunicornServer(ServerAdapter):
def run(self, handler):
from gunicorn.app.base import Application

config = {'bind': "%s:%d" % (self.host, int(self.port))}
if self.host.startswith("unix:"):
config = {'bind': self.host}
else:
config = {'bind': "%s:%d" % (self.host, self.port)}

config.update(self.options)

class GunicornApplication(Application):
Expand Down Expand Up @@ -3714,8 +3718,11 @@ def run(app=None,
if not server.quiet:
_stderr("Bottle v%s server starting up (using %s)...\n" %
(__version__, repr(server)))
_stderr("Listening on http://%s:%d/\n" %
(server.host, server.port))
if server.host.startswith("unix:"):
_stderr("Listening on %s\n" % server.host)
else:
_stderr("Listening on http://%s:%d/\n" %
(server.host, server.port))
_stderr("Hit Ctrl-C to quit.\n\n")

if reloader:
Expand Down

0 comments on commit 4164c3f

Please sign in to comment.