Skip to content
This repository was archived by the owner on Jun 22, 2025. It is now read-only.

Commit 2c0b053

Browse files
Merge pull request #340 from samuelhwilliams/default-index-html
Retrieve a default file at the root URL
2 parents 2db3c83 + 11bcde3 commit 2c0b053

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

eel/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
'app_mode': True, # (Chrome specific option)
4848
'all_interfaces': False, # Allow bottle server to listen for connections on all interfaces
4949
'disable_cache': True, # Sets the no-store response header when serving assets
50+
'default_path': 'index.html', # The default file to retrieve for the root URL
5051
'app': btl.default_app(), # Allows passing in a custom Bottle instance, e.g. with middleware
5152
}
5253

@@ -193,6 +194,9 @@ def _eel():
193194
_set_response_headers(btl.response)
194195
return page
195196

197+
def _root():
198+
return _static(_start_args['default_path'])
199+
196200
def _static(path):
197201
response = None
198202
if 'jinja_env' in _start_args and 'jinja_templates' in _start_args:
@@ -236,6 +240,7 @@ def _websocket(ws):
236240

237241
BOTTLE_ROUTES = {
238242
"/eel.js": (_eel, dict()),
243+
"/": (_root, dict()),
239244
"/<path:path>": (_static, dict()),
240245
"/eel": (_websocket, dict(apply=[wbs.websocket]))
241246
}

0 commit comments

Comments
 (0)