Skip to content

Commit d74fd10

Browse files
committed
Added local directory to server
1 parent f2fe683 commit d74fd10

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

nengo_gui/server.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@ def swi_static(self, *path):
5454
data = pkgutil.get_data('nengo_gui', fn)
5555
return (mimetype, data)
5656

57+
def swi_local(self, *path):
58+
"""Handles http://host:port/local/* by using local directory"""
59+
fn = os.path.join('local', *path)
60+
mimetype, encoding = mimetypes.guess_type(fn)
61+
with open(fn, 'rb') as f:
62+
data = f.read()
63+
return (mimetype, data)
64+
5765
def swi_favicon_ico(self):
5866
icon = pkgutil.get_data('nengo_gui', 'static/favicon.ico')
5967
return ('image/ico', icon)

0 commit comments

Comments
 (0)