From 82676862ca7af6ca6d883e33f18d3e0b400b33a8 Mon Sep 17 00:00:00 2001 From: Florian Mounier Date: Mon, 3 Sep 2018 11:54:38 +0200 Subject: [PATCH] Fix one-shot auto-open url when uri-root-path is used. --- Makefile | 1 - butterfly.server.py | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 050c5af..38f1a9b 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,6 @@ check-outdated: ARGS ?= --port=1212 --unsecure --debug run-debug: - sleep 0.5 && $(BROWSER) http://localhost:1212& $(PYTHON) ./butterfly.server.py $(ARGS) build-coffee: diff --git a/butterfly.server.py b/butterfly.server.py index 7ec151c..ea4fe1c 100755 --- a/butterfly.server.py +++ b/butterfly.server.py @@ -375,8 +375,10 @@ ioloop = tornado.ioloop.IOLoop.instance() if port == 0: port = list(http_server._sockets.values())[0].getsockname()[1] -url = "http%s://%s:%d/" % ( - "s" if not options.unsecure else "", host, port) +url = "http%s://%s:%d/%s" % ( + "s" if not options.unsecure else "", host, port, + (options.uri_root_path.strip('/') + '/') if options.uri_root_path else '' +) if not options.one_shot or not webbrowser.open(url): log.warn('Butterfly is ready, open your browser to: %s' % url)