当前位置: 首页>>代码示例>>Python>>正文


Python Configurator.make_wsgi_app方法代码示例

本文整理汇总了Python中pyramid.configuration.Configurator.make_wsgi_app方法的典型用法代码示例。如果您正苦于以下问题:Python Configurator.make_wsgi_app方法的具体用法?Python Configurator.make_wsgi_app怎么用?Python Configurator.make_wsgi_app使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyramid.configuration.Configurator的用法示例。


在下文中一共展示了Configurator.make_wsgi_app方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from pyramid.configuration import Configurator [as 别名]
# 或者: from pyramid.configuration.Configurator import make_wsgi_app [as 别名]
def main(global_config, **settings):
    """ This function returns a WSGI application.
    """
    engine = engine_from_config(settings, 'sqlalchemy.')
    initialize_sql(engine)
    authn_policy = AuthTktAuthenticationPolicy(
        'sosecret', callback=groupfinder)
    authz_policy = ACLAuthorizationPolicy()
    config = Configurator(settings=settings,
                          root_factory='tutorial.models.RootFactory',
                          authentication_policy=authn_policy,
                          authorization_policy=authz_policy)
    config.add_static_view('static', 'tutorial:static')
    config.add_route('view_wiki', '/', view='tutorial.views.view_wiki')
    config.add_route('login', '/login',
                     view='tutorial.login.login',
                     view_renderer='tutorial:templates/login.pt')
    config.add_route('logout', '/logout',
                     view='tutorial.login.logout')
    config.add_route('view_page', '/{pagename}',
                     view='tutorial.views.view_page',
                     view_renderer='tutorial:templates/view.pt')
    config.add_route('add_page', '/add_page/{pagename}',
                     view='tutorial.views.add_page',
                     view_renderer='tutorial:templates/edit.pt',
                     view_permission='edit')
    config.add_route('edit_page', '/{pagename}/edit_page',
                     view='tutorial.views.edit_page',
                     view_renderer='tutorial:templates/edit.pt',
                     view_permission='edit')
    config.add_view('tutorial.login.login',
                    renderer='tutorial:templates/login.pt',
                    context='pyramid.exceptions.Forbidden')
    return config.make_wsgi_app()
开发者ID:blaflamme,项目名称:pyramid,代码行数:36,代码来源:__init__.py

示例2: app

# 需要导入模块: from pyramid.configuration import Configurator [as 别名]
# 或者: from pyramid.configuration.Configurator import make_wsgi_app [as 别名]
def app(global_config, **settings):
    """ This function returns a WSGI application.
    
    It is usually called by the PasteDeploy framework during 
    ``paster serve``.
    """
    db_string = settings.get('db_string')
    if db_string is None:
        raise ValueError("No 'db_string' value in application configuration.")
    db_echo = settings.get('db_echo', 'false')
    initialize_sql(db_string, asbool(db_echo))
    config = Configurator(settings=settings)
    config.begin()
    config.add_static_view('static', 'tutorial:static')
    config.add_route('home', '/', view='tutorial.views.view_wiki')
    config.add_route('view_page', '/:pagename',
                     view='tutorial.views.view_page',
                     view_renderer='tutorial:templates/view.pt')
    config.add_route('add_page', '/add_page/:pagename',
                     view='tutorial.views.add_page',
                     view_renderer='tutorial:templates/edit.pt')
    config.add_route('edit_page', '/:pagename/edit_page',
                     view='tutorial.views.edit_page',
                     view_renderer='tutorial:templates/edit.pt')
    config.end()
    return config.make_wsgi_app()
开发者ID:rjweir,项目名称:pyramid,代码行数:28,代码来源:__init__.py

示例3: app

# 需要导入模块: from pyramid.configuration import Configurator [as 别名]
# 或者: from pyramid.configuration.Configurator import make_wsgi_app [as 别名]
def app(global_config, **settings):
    """ This function returns a WSGI application.
    
    It is usually called by the PasteDeploy framework during 
    ``paster serve``.
    """
    config = Configurator(root_factory=get_root, settings=settings)
    config.begin()
    session_factory = session_factory_from_settings(settings)
    config.set_session_factory(session_factory)

    tictactroll.gamestate.set_db_path(settings.get('db_path'))

    config.add_view("tictactroll.views.game", name="game",
                    renderer="tictactroll:templates/game.mako")
    config.add_view("tictactroll.views.about", name="about",
                    renderer="tictactroll:templates/about.mako")
    config.add_view("tictactroll.views.welcome",
                    renderer="tictactroll:templates/welcome.mako")
    config.add_view("tictactroll.views.enter_game", name="enter_game")
    config.add_view("tictactroll.views.new_game", name="new_game")

    config.add_view("tictactroll.views.add_grid", name="add_grid",
                    renderer="json")

    config.add_view("tictactroll.views.next_troll_grid",
                    name="next_troll_grid", renderer="json")

    config.add_view("tictactroll.views.gameover_html", name="gameover",
                    renderer="tictactroll:templates/gameover.mako")

    config.add_static_view("static", "tictactroll:static")
    config.end()
    return config.make_wsgi_app()
开发者ID:tamentis,项目名称:tictactroll,代码行数:36,代码来源:__init__.py

示例4: app

# 需要导入模块: from pyramid.configuration import Configurator [as 别名]
# 或者: from pyramid.configuration.Configurator import make_wsgi_app [as 别名]
def app(global_config, **settings):
    """ This function returns a WSGI application.
    
    It is usually called by the PasteDeploy framework during 
    ``paster serve``.
    """
    db_string = settings.get("db_string")
    if db_string is None:
        raise ValueError("No 'db_string' value in application configuration.")
    db_echo = settings.get("db_echo", "false")
    initialize_sql(db_string, asbool(db_echo))
    config = Configurator(settings=settings)
    config.begin()
    config.add_static_view("static", "tutorial:static")
    config.add_route("home", "/", view="tutorial.views.view_wiki")
    config.add_route(
        "view_page", "/:pagename", view="tutorial.views.view_page", view_renderer="tutorial:templates/view.pt"
    )
    config.add_route(
        "add_page", "/add_page/:pagename", view="tutorial.views.add_page", view_renderer="tutorial:templates/view.pt"
    )
    config.add_route(
        "edit_page", "/:pagename/edit_page", view="tutorial.views.edit_page", view_renderer="tutorial:templates/edit.pt"
    )
    config.end()
    return config.make_wsgi_app()
开发者ID:rick446,项目名称:pyramid,代码行数:28,代码来源:__init__.py

示例5: main

# 需要导入模块: from pyramid.configuration import Configurator [as 别名]
# 或者: from pyramid.configuration.Configurator import make_wsgi_app [as 别名]
def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    engine = engine_from_config(settings, "sqlalchemy.")
    initialize_sql(engine)
    config = Configurator(settings=settings)
    config.add_static_view("static", "tutorial:static")
    config.add_route("home", "/", view="tutorial.views.my_view", view_renderer="templates/mytemplate.pt")
    return config.make_wsgi_app()
开发者ID:blaflamme,项目名称:pyramid,代码行数:11,代码来源:__init__.py

示例6: main

# 需要导入模块: from pyramid.configuration import Configurator [as 别名]
# 或者: from pyramid.configuration.Configurator import make_wsgi_app [as 别名]
def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    config = Configurator(root_factory=get_root, settings=settings)
    config.add_view('myproject.views.my_view',
                    context='myproject.models.MyModel',
                    renderer='myproject:templates/mytemplate.pt')
    config.add_static_view('static', 'myproject:static')
    return config.make_wsgi_app()
开发者ID:pyeek,项目名称:pyramid,代码行数:11,代码来源:__init__.py

示例7: setUp

# 需要导入模块: from pyramid.configuration import Configurator [as 别名]
# 或者: from pyramid.configuration.Configurator import make_wsgi_app [as 别名]
 def setUp(self):
     from pyramid.configuration import Configurator
     config = Configurator(root_factory=self.root_factory)
     config.begin()
     config.load_zcml(self.config)
     app = config.make_wsgi_app()
     from webtest import TestApp
     self.testapp = TestApp(app)
     self.config = config
开发者ID:blaflamme,项目名称:pyramid,代码行数:11,代码来源:test_integration.py

示例8: app

# 需要导入模块: from pyramid.configuration import Configurator [as 别名]
# 或者: from pyramid.configuration.Configurator import make_wsgi_app [as 别名]
def app(global_config, **settings):
    """ This function returns a WSGI application.
    
    It is usually called by the PasteDeploy framework during 
    ``paster serve``.
    """
    config = Configurator(root_factory=get_root, settings=settings)
    config.begin()
    config.load_zcml('configure.zcml')
    config.end()
    return config.make_wsgi_app()
开发者ID:srid,项目名称:hydra,代码行数:13,代码来源:__init__.py

示例9: app

# 需要导入模块: from pyramid.configuration import Configurator [as 别名]
# 或者: from pyramid.configuration.Configurator import make_wsgi_app [as 别名]
def app(global_config, **settings):
    """ This function returns a ``pyramid`` application object.  It
    is usually called by the PasteDeploy framework during ``paster
    serve``"""
    combined_config = {}
    combined_config.update(global_config)
    combined_config.update(settings)
    setup_model(**combined_config)
    config = Configurator(root_factory=get_root, settings=combined_config)
    config.scan()
    config.add_static_view(name="static", path="spazzer.web:templates/static")
    return config.make_wsgi_app()
开发者ID:twillis,项目名称:spazzer,代码行数:14,代码来源:run.py

示例10: app

# 需要导入模块: from pyramid.configuration import Configurator [as 别名]
# 或者: from pyramid.configuration.Configurator import make_wsgi_app [as 别名]
def app(global_config, **settings):
    db_uri = settings.get('db_uri')
    db_name = settings.get('db_name')
    if db_uri is None or db_name is None:
        raise ValueError("db_uri AND db_name must be defined"
                         " in application initilization configuration file")
    zcml_file = settings.get('configure_zcml', 'configure.zcml')
    config = Configurator(root_factory=RootFactory, settings=settings)
    config.begin()
    config.load_zcml(zcml_file)
    config.end()
    return config.make_wsgi_app()
开发者ID:GunioRobot,项目名称:ravel,代码行数:14,代码来源:run.py

示例11: main

# 需要导入模块: from pyramid.configuration import Configurator [as 别名]
# 或者: from pyramid.configuration.Configurator import make_wsgi_app [as 别名]
def main(global_config, **settings):
    """ This function returns a WSGI application.
    """
    db_string = settings.get("db_string")
    if db_string is None:
        raise ValueError("No 'db_string' value in application configuration.")
    db_echo = settings.get("db_echo", "false")
    get_root = appmaker(db_string, asbool(db_echo))
    config = Configurator(settings=settings, root_factory=get_root)
    config.add_static_view("static", "meteoglobal:static")
    config.add_view("meteoglobal.views.view_root", context="meteoglobal.models.MyApp", renderer="templates/root.pt")
    config.add_view("meteoglobal.views.view_model", context="meteoglobal.models.MyModel", renderer="templates/model.pt")
    return config.make_wsgi_app()
开发者ID:tamentis,项目名称:meteoglobal,代码行数:15,代码来源:__init__.py

示例12: main

# 需要导入模块: from pyramid.configuration import Configurator [as 别名]
# 或者: from pyramid.configuration.Configurator import make_wsgi_app [as 别名]
def main(global_config, **settings):
    """ This function returns a WSGI application.
    """
    db_string = settings.get('db_string')
    if db_string is None:
        raise ValueError("No 'db_string' value in application configuration.")
    db_echo = settings.get('db_echo', 'false')
    initialize_sql(db_string, asbool(db_echo))
    config = Configurator(settings=settings)
    config.add_static_view('static', 'tutorial:static')
    config.add_route('home', '/', view='tutorial.views.my_view',
                     view_renderer='templates/mytemplate.pt')
    return config.make_wsgi_app()
开发者ID:pyeek,项目名称:pyramid,代码行数:15,代码来源:__init__.py

示例13: main

# 需要导入模块: from pyramid.configuration import Configurator [as 别名]
# 或者: from pyramid.configuration.Configurator import make_wsgi_app [as 别名]
def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    zodb_uri = settings.get('zodb_uri')
    if zodb_uri is None:
        raise ValueError("No 'zodb_uri' in application configuration.")

    finder = PersistentApplicationFinder(zodb_uri, appmaker)
    def get_root(request):
        return finder(request.environ)
    config = Configurator(root_factory=get_root, settings=settings)
    config.load_zcml('configure.zcml')
    return config.make_wsgi_app()
开发者ID:blaflamme,项目名称:pyramid,代码行数:15,代码来源:__init__.py

示例14: app

# 需要导入模块: from pyramid.configuration import Configurator [as 别名]
# 或者: from pyramid.configuration.Configurator import make_wsgi_app [as 别名]
def app(global_config, **settings):
    """ This function returns a WSGI application.
    
    It is usually called by the PasteDeploy framework during 
    ``paster serve``.
    """
    config = Configurator(root_factory=get_root, settings=settings)
    config.begin()
    config.add_view('myproject.views.my_view',
                    context='myproject.models.MyModel',
                    renderer='myproject:templates/mytemplate.pt')
    config.add_static_view('static', 'myproject:static')
    config.end()
    return config.make_wsgi_app()
开发者ID:junkafarian,项目名称:pyramid,代码行数:16,代码来源:__init__.py

示例15: make_pyramid_app

# 需要导入模块: from pyramid.configuration import Configurator [as 别名]
# 或者: from pyramid.configuration.Configurator import make_wsgi_app [as 别名]
def make_pyramid_app(global_config, **kwargs):
    """ This function returns a WSGI application.
    """

    settings = dict(global_config)
    settings.update(kwargs)
    config = Configurator(root_factory=get_root,
                          settings=init_settings(global_config))
    config.add_renderer('.html', renderer_factory)
    config.add_static_view('static', 'academe:static')
    config.scan('academe')

    pyramid_app = config.make_wsgi_app()

    return pyramid_app
开发者ID:jcress410,项目名称:academe,代码行数:17,代码来源:__init__.py


注:本文中的pyramid.configuration.Configurator.make_wsgi_app方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。