Skip to content

Commit 610475c

Browse files
authored
Merge pull request #224 from MagpieEmbedded/master
Allow control of default filename option
2 parents ab55ca7 + 7643ea4 commit 610475c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

livereload/server.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,13 +306,13 @@ def get_web_handlers(self, script):
306306
return [
307307
(r'/(.*)', self.SFH, {
308308
'path': self.root or '.',
309-
'default_filename': 'index.html',
309+
'default_filename': self.default_filename,
310310
}),
311311
]
312312

313313
def serve(self, port=5500, liveport=None, host=None, root=None, debug=None,
314314
open_url=False, restart_delay=2, open_url_delay=None,
315-
live_css=True):
315+
live_css=True, default_filename='index.html'):
316316
"""Start serve the server with the given port.
317317
318318
: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,
325325
:param open_url_delay: open webbrowser after the delay seconds
326326
:param live_css: whether to use live css or force reload on css.
327327
Defaults to True
328+
:param default_filename: launch this file from the selected root on startup
328329
"""
329330
host = host or '127.0.0.1'
330331
if root is not None:
@@ -333,6 +334,8 @@ def serve(self, port=5500, liveport=None, host=None, root=None, debug=None,
333334
self._setup_logging()
334335
logger.info('Serving on http://%s:%s' % (host, port))
335336

337+
self.default_filename = default_filename
338+
336339
self.application(
337340
port, host, liveport=liveport, debug=debug, live_css=live_css)
338341

0 commit comments

Comments
 (0)