Пример #1
0
def app_factory(global_config, **local_config):
    """ Use `./bin/paster serve path/to/config.ini to 
      instantiate a WSGI application.
        
      Enter the debug shell using the command line option 
      `shell=true`.  This will start an interpreter with
      the components registry available as `gsm` and the
      parsed config as `settings`.
    """
    
    # parse config
    settings = _parse_config(global_config, local_config)
    
    # bootstrap components
    bootstrapper = Bootstrapper(settings=settings)
    bootstrapper.setup_components()
    
    # if the user has set the shell 
    if settings['shell']:
        # get a handle on the component registry and interact
        from zope.component import getGlobalSiteManager
        gsm = getGlobalSiteManager()
        # interact
        import code
        code.interact(local=locals())
    
    # return wsgi app
    return web.WSGIApplication(mapping, settings=settings)