Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit ae3d7da

Browse files
committedJul 1, 2016
Added local directory to server
1 parent 39c9f02 commit ae3d7da

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed
 

‎nengo_gui/server.py

+8
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)
Please sign in to comment.