mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-27 04:20:22 +08:00
handle single static path in FileFindHandler
This commit is contained in:
parent
2891a0a8ca
commit
3c6c38289a
@ -749,6 +749,8 @@ class FileFindHandler(web.StaticFileHandler):
|
||||
_static_paths = {}
|
||||
|
||||
def initialize(self, path, default_filename=None):
|
||||
if isinstance(path, basestring):
|
||||
path = [path]
|
||||
self.roots = tuple(
|
||||
os.path.abspath(os.path.expanduser(p)) + os.path.sep for p in path
|
||||
)
|
||||
@ -849,14 +851,16 @@ class FileFindHandler(web.StaticFileHandler):
|
||||
could be determined.
|
||||
"""
|
||||
# begin subclass override:
|
||||
static_path = settings['static_path']
|
||||
static_paths = settings['static_path']
|
||||
if isinstance(static_paths, basestring):
|
||||
static_paths = [static_paths]
|
||||
roots = tuple(
|
||||
os.path.abspath(os.path.expanduser(p)) + os.path.sep for p in static_path
|
||||
os.path.abspath(os.path.expanduser(p)) + os.path.sep for p in static_paths
|
||||
)
|
||||
|
||||
try:
|
||||
abs_path = filefind(path, roots)
|
||||
except Exception:
|
||||
except IOError:
|
||||
logging.error("Could not find static file %r", path)
|
||||
return None
|
||||
|
||||
|
@ -155,7 +155,7 @@ class NotebookWebApplication(web.Application):
|
||||
|
||||
settings = dict(
|
||||
template_path=os.path.join(os.path.dirname(__file__), "templates"),
|
||||
static_path=os.path.join(os.path.dirname(__file__), "static"),
|
||||
static_path=ipython_app.static_file_path,
|
||||
static_handler_class = FileFindHandler,
|
||||
cookie_secret=os.urandom(1024),
|
||||
login_url="%s/login"%(base_project_url.rstrip('/')),
|
||||
|
Loading…
Reference in New Issue
Block a user