本文整理汇总了Python中bokeh.application.handlers.DirectoryHandler类的典型用法代码示例。如果您正苦于以下问题:Python DirectoryHandler类的具体用法?Python DirectoryHandler怎么用?Python DirectoryHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DirectoryHandler类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build_applications
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
示例2: load
def load(filename):
handler = DirectoryHandler(filename=filename)
assert handler.safe_to_fork
result['handler'] = handler
handler.modify_document(doc)
if handler.failed:
raise RuntimeError(handler.error)
assert not handler.safe_to_fork
示例3: load
def load(filename):
handler = DirectoryHandler(filename=filename)
handler.modify_document(doc)
if handler.failed:
raise RuntimeError(handler.error)