Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google App Engine: Redirect to RequestHandler

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.

like image 515
Pickels Avatar asked Jun 25 '26 07:06

Pickels


1 Answers

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.

like image 79
Blair Conrad Avatar answered Jun 27 '26 20:06

Blair Conrad