Routing confuses me. But not always.
The app we’re working on lately combines Django and Angular. Both great frameworks that function similarly in some ways (injecting templates directly into the html, even using the same curly brackets), but very different in others. Like routing.
Or maybe it’s just me. I find Angular (1.x) routing really straightforward to use. You’ve got your routeProvider, can grab GET parameters off the routeParams object, and just set up your .when() calls. Although, as a short aside, I did find one gotcha with Angular. I thought I was being so clever- I wanted to set up a default route using .otherwise() to make a 404 type page for the app. So if a user goes to a url that doesn’t exist, they get a nice message that they’re lost and a link to a sitemap type screen. However, the default route will show on first display of the app, so that was kind of tricky. I didn’t want a 404 to be the first thing people see! So I tried to make a .when(‘/’) route, and have .otherwise point to that. This is not a good idea. It created an infinite loop that crashed Chrome (unrecoverable- had to ctrl-alt-delete out of it). So don’t do that!
But in general, Angular’s routes are really nice to use. I had (have) more trouble with setting up Django’s routing. Maybe it’s my (rational) fear of regexes, but the urls.py file reads like Greek to me. I can get simple routes working- but that’s mainly what I was able to tweak after doing the default Django blog tutorial. The concepts behind Django routing seem to make sense, it’s just the practice of getting them to work (without spending hours of trial and error) that’s taking quite a bit longer to learn.
But in all, both are great ways of handling the request/response of the web. Set up one section of routing (or two with Django- you need the views.py as well) and let the framework do the heavy lifting!