本文整理汇总了Python中pyramid.configuration.Configurator.include方法的典型用法代码示例。如果您正苦于以下问题:Python Configurator.include方法的具体用法?Python Configurator.include怎么用?Python Configurator.include使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyramid.configuration.Configurator
的用法示例。
在下文中一共展示了Configurator.include方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from pyramid.configuration import Configurator [as 别名]
# 或者: from pyramid.configuration.Configurator import include [as 别名]
def main(global_config, **settings):
""" This function returns a Pyramid WSGI application.
"""
config = Configurator()
config.begin()
db_uri = settings['db_uri']
server_url = settings['server_url']
conn = Connection(db_uri)
config.registry.settings['db_conn'] = conn
config.registry.settings['server_url'] = server_url
config.registry.settings['db_name'] = settings['db_name']
config.add_subscriber(add_mongo_db, NewRequest)
config.include('pyramid_zcml')
config.load_zcml('configure.zcml')
config.end()
#add renderer
#Fixme: try to insert this on zcml file
config.add_renderer('jsonp', JSONP(param_name='callback'))
return config.make_wsgi_app()