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:
-
Nov 8, 2009, 9:27:20 PM (15 years ago)
- Author:
-
cmlenz
- Comment:
-
Add info on rerouting
Legend:
- Unmodified
- Added
- Removed
- Modified
-
v13
|
v14
|
|
58 | 58 | Finally, the `redirect_to(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 | === Rerouting Generated URLs === |
| 61 | |
| 62 | The routing can be configured to reroute certain routes to different URLs for URL generation. For example, you could set up a static resource directory to be rerouted to one or more different host name. |
| 63 | |
| 64 | {{{ |
| 65 | #!python |
| 66 | app.routing.reroute('media', |
| 67 | lambda filename=None: 'http://static.example.com/%s' % filename |
| 68 | ) |
| 69 | }}} |
| 70 | |
| 71 | This only has effect on URL generation. If the route is setup to also handle incoming requests, they will still be matched and processed as before. |
| 72 | |
60 | 73 | == Delegating to Other WSGI Applications == |
61 | 74 | |