close Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Changes between Version 8 and Version 9 of UrlRouting


Ignore:
Timestamp:
Aug 7, 2008, 5:09:20 PM (16 years ago)
Author:
cmlenz
Comment:

Document WSGI delegation

Legend:

Unmodified
Added
Removed
Modified
  • UrlRouting

    v8 v9  
    5858Finally, the `redirect(target, *args, **kwargs)` function is a shortcut for redirecting to the absolutized result of `path_to(). It will raise an HTTP exception, and thus immediately break out of the current code.
    5959
     60== Delegating to Other WSGI Applications ==
     61
     62You can mount other WSGI-based applications into the URI namespace of the Diva application using the `delegate` request handler in the `diva.routing` module.
     63
     64For example, the following routing configuration would mount [http://trac.edgewall.org/ Trac] under the `/trac` prefix:
     65
     66{{{
     67#!routingconf
     68trac:           /trac{path:.*}          -> diva.routing:delegate
     69    application = "trac.web.main.dispatch_request"
     70    environ = {"trac.env_path": "/var/trac/teo"}
     71}}}
     72
     73The `application` parameter is needed to determine which WSGI application is delegated to. The `environ` parameter can be used to specify a dictionary of variables that should be added to the WSGI environ, which may be needed by the target app. Finally, a delegating route should use a `path` URL part that will be used as the `PATH_INFO` for the target application.
     74
    6075== API Documentation ==
    6176
    6277[[PythonDoc(trunk, diva.routing)]]
    63