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.
- Timestamp:
-
Aug 7, 2008, 5:09:20 PM (16 years ago)
- Author:
-
cmlenz
- Comment:
-
Document WSGI delegation
Legend:
- Unmodified
- Added
- Removed
- Modified
-
v8
|
v9
|
|
58 | 58 | Finally, 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. |
59 | 59 | |
| 60 | == Delegating to Other WSGI Applications == |
| 61 | |
| 62 | You 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 | |
| 64 | For example, the following routing configuration would mount [http://trac.edgewall.org/ Trac] under the `/trac` prefix: |
| 65 | |
| 66 | {{{ |
| 67 | #!routingconf |
| 68 | trac: /trac{path:.*} -> diva.routing:delegate |
| 69 | application = "trac.web.main.dispatch_request" |
| 70 | environ = {"trac.env_path": "/var/trac/teo"} |
| 71 | }}} |
| 72 | |
| 73 | The `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 | |
60 | 75 | == API Documentation == |
61 | 76 | |
62 | 77 | [[PythonDoc(trunk, diva.routing)]] |
63 | | |