Skip to content

Commit

Permalink
Merge pull request #224 from MagpieEmbedded/master
Browse files Browse the repository at this point in the history
Allow control of default filename option
  • Loading branch information
bmcculley authored Aug 21, 2020
2 parents ab55ca7 + 7643ea4 commit 610475c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions livereload/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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)

Expand Down

0 comments on commit 610475c

Please sign in to comment.