Skip to content

Commit

Permalink
Added local directory to server
Browse files Browse the repository at this point in the history
  • Loading branch information
tcstewar committed Jun 4, 2016
1 parent f2fe683 commit d74fd10
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions nengo_gui/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ def swi_static(self, *path):
data = pkgutil.get_data('nengo_gui', fn)
return (mimetype, data)

def swi_local(self, *path):
"""Handles http://host:port/local/* by using local directory"""
fn = os.path.join('local', *path)
mimetype, encoding = mimetypes.guess_type(fn)
with open(fn, 'rb') as f:
data = f.read()
return (mimetype, data)

def swi_favicon_ico(self):
icon = pkgutil.get_data('nengo_gui', 'static/favicon.ico')
return ('image/ico', icon)
Expand Down

0 comments on commit d74fd10

Please sign in to comment.