@Jonathan. Parametric Router. I just read the book again and I had overlooked that with the parametric router you cannot have app specific routes in the app folder. That is a shame because I had always thought a main advantage of having an app specific routes.py is so that it could be distributed with the app. This in itself may be a reason to avoid it. An app that depends on this functionality cannot be distributed in the normal way?
I cannot see why the root routes.py cannot determine whether it has recognised an app. Afterall, we are telling it the app names. I am suggesting the flow as follows: 1. Look for root routes.py. 2. See whether there are any apps specified which have their own routing. The test for this is simply to look at the first arg of the URL after the domain:port. The routes can already do that, can't they? 3. If app specific routes apply, then go and get the app/routes.py and follow that. 4. If not, then follow the default routes. In all cases, the user can opt for parametric routes or pattern routes. Maybe a flag at the start of each file should make it clear which. I am not asking for anything which isn't already available in one form or another. You are saying it is non-trivial. Well I definitely agree with that! However, if it already available, then surely it is possible. @Anthony. As you say, the naming is not really an issue as long as everything is clear and you suggest the documentation is pretty adequate -- but evidently it is not. In my original post above, I described a simple case which appears to be possible with the parametric router, but you concede that it is not. This has got me wondering how we might make all this more obvious, so that in future people like me can figure it out without wasting other peoples' time. In referring back to my original post, I am hoping that this test case will be a catalyst to getting a clearer routing solution. Thanks, David On Friday, June 29, 2012 2:06:43 PM UTC+1, Jonathan Lundell wrote: > > On Jun 29, 2012, at 5:08 AM, villas wrote: > > 4. For example, I suggest the root router should go something like this: > > default_app = myapp > ## default_app will be applied whenever the app is not obviously > identifiable > > apps_with_own_routers = [app1, app2] > ## app1, app2 must have their own routers, which may be 'lite' or > 'comprehensive' > > > One reason we don't split the functionality this way is that determining > the application to route to is a (non-trivial) part of the routing function > (consider for example routing to applications on the basis of domain, port, > etc). And it's unusual (I think) to have multiple apps in the same > installation that both need complex but radically different routing. >