本文整理汇总了Python中bokeh.application.handlers.DirectoryHandler.url_path方法的典型用法代码示例。如果您正苦于以下问题:Python DirectoryHandler.url_path方法的具体用法?Python DirectoryHandler.url_path怎么用?Python DirectoryHandler.url_path使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bokeh.application.handlers.DirectoryHandler
的用法示例。
在下文中一共展示了DirectoryHandler.url_path方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build_applications
# 需要导入模块: from bokeh.application.handlers import DirectoryHandler [as 别名]
# 或者: from bokeh.application.handlers.DirectoryHandler import url_path [as 别名]
def build_applications(self, args):
if args.files:
files = args.files
else:
files = []
applications = {}
for file in files:
file = os.path.abspath(file)
if os.path.isdir(file):
handler = DirectoryHandler(filename=file)
else:
handler = ScriptHandler(filename=file)
if handler.failed:
die("Error loading %s:\n\n%s\n%s " % (file, handler.error, handler.error_detail))
application = Application()
application.add(handler)
route = handler.url_path()
if not route:
if '/' in applications:
die("Don't know the URL path to use for %s" % (file))
route = '/'
applications[route] = application
if len(applications) == 0:
# create an empty application by default, used with output_server typically
applications['/'] = Application()
return applications