Good point, Anthony. I forgot they are evaluated in order. So you can declare them explicitly before the generic pattern and achieve the same result. For bonus points, OP, you should make it RESTful like I did with mine and then heavily leverage the default layout :) Mine's currently up at the super cliché url http://rdzr.co :)
On Thu, Mar 29, 2012 at 1:40 PM, Anthony <abasta...@gmail.com> wrote: >> routes_in = ( >> (r'^/?$', r'/app_name/default/index'), >> (r'^/(?P<url>[^/]*)/?$', r'/app_name/default/index/\g<url>'), >> >> ) >> >> >> in your root-level routes.py The drawback is that you will lose access to >> all other apps (including admin) but that can be a good thing for public >> deployments. > > > You can catch the other apps by adding route patterns that match them before > your catch-all pattern (the patterns are processed in order, and the first > match is used). Anyway, using the parametric router and specifying the > url-shortening app as the default app might be simpler: > > routers = dict( > BASE = dict( > default_application = 'shortener', > default_controller = 'default', > default_function = 'index', > ), > ) > > Then http://myapp.com/tcgata will get routed to > http://myapp.com/shortener/default/index/tcgata, and "tcgata" will be > available to the index() function in request.args(0). > > Anthony