From 7643ea4bf79dcf9e551b5787d1e93a2e57fc8d3f Mon Sep 17 00:00:00 2001 From: Mapgie Embedded Date: Wed, 8 Jul 2020 18:53:23 +0100 Subject: [PATCH] Added default filename option --- livereload/server.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/livereload/server.py b/livereload/server.py index 70f21b4..34e2be5 100644 --- a/livereload/server.py +++ b/livereload/server.py @@ -306,13 +306,13 @@ def get_web_handlers(self, script): return [ (r'/(.*)', self.SFH, { 'path': self.root or '.', - 'default_filename': 'index.html', + 'default_filename': self.default_filename, }), ] def serve(self, port=5500, liveport=None, host=None, root=None, debug=None, open_url=False, restart_delay=2, open_url_delay=None, - live_css=True): + live_css=True, default_filename='index.html'): """Start serve the server with the given port. :param port: serve on this port, default is 5500 @@ -325,6 +325,7 @@ def serve(self, port=5500, liveport=None, host=None, root=None, debug=None, :param open_url_delay: open webbrowser after the delay seconds :param live_css: whether to use live css or force reload on css. Defaults to True + :param default_filename: launch this file from the selected root on startup """ host = host or '127.0.0.1' if root is not None: @@ -333,6 +334,8 @@ def serve(self, port=5500, liveport=None, host=None, root=None, debug=None, self._setup_logging() logger.info('Serving on http://%s:%s' % (host, port)) + self.default_filename = default_filename + self.application( port, host, liveport=liveport, debug=debug, live_css=live_css)