本文整理汇总了Python中pyramid.configuration.Configurator.add_handler方法的典型用法代码示例。如果您正苦于以下问题:Python Configurator.add_handler方法的具体用法?Python Configurator.add_handler怎么用?Python Configurator.add_handler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyramid.configuration.Configurator
的用法示例。
在下文中一共展示了Configurator.add_handler方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from pyramid.configuration import Configurator [as 别名]
# 或者: from pyramid.configuration.Configurator import add_handler [as 别名]
def main(global_config, **settings):
""" This function returns a Pyramid WSGI application.
"""
from pyramid.configuration import Configurator
config = Configurator(settings=settings)
config.add_renderer(name = 'nt', factory='.renderers.NTriplesGraphRenderer')
config.add_renderer(name = 'rdfxml', factory='.renderers.RDFXMLGraphRenderer')
config.add_renderer(name = 'n3', factory='.renderers.N3GraphRenderer')
session_factory = session_factory_from_settings(settings)
config.set_session_factory(session_factory)
config.registry['sparql.url'] = settings['sparql.url']
config.add_static_view('static', 'sparql_shim:static/')
config.add_handler('direct_graph', '/{name:.+}', '.handlers:GraphHandler',
action='graph')
config.add_handler('indirect_graph', '/', '.handlers:GraphHandler',
action='graph')
config.scan('sparql_shim.subscribers')
return config.make_wsgi_app()