views:

49

answers:

2

Hello,

I just started with Google App Engine using python and I was following a tutorial and writing my own little app to get familiar the webapp framework. Now I just noticed the tutorial does the following self.redirect('/'). So that got me wondering: is there a way to redirect to a handler instead of a hardcoded path? Thought that might be better so that you can change your urls without breaking your app.

+3  A: 

One alternative would be to have a map of symbolic names to URLs, that way you could redirect to the mapped URL - you could then update your URLs with impunity.

Or if you'd rather just execute the code from another handler, I don't know why you couldn't just make a method call - worst case, you could extract a common method from the two handlers and call that.

Blair Conrad
+1  A: 

This isn't a limitation of App Engine so much as the webapp framework. webapp is intended to be a lightweight framework, providing just the essentials.

If you want fancier redirect behavior, try Django.

Drew Sears