====== Google GAE中使用重定向 ====== ===== GAE 302 暂时重定向 ===== request对象带有redirect函数可以实现重定向,redirect接受一个url网址作为重定向网址。 在默认参数的情况下,redirect函数实现的重定向为302暂时重定向。 class FormHandler(webapp.RequestHandler): def post(self): if processFormData(self.request): self.redirect("/home") else: # Display the form, possibly with error messages. ===== GAE 301 永久重定向 ===== 其实Google App Engine 中实现301重定向非常简单,只要设置request对象redirect的可选参数 permanent=True 就可以实现301重定向了。 self.redirect("/home", permanent=True) ===== 参考 ===== * http://code.google.com/appengine/docs/python/tools/webapp/redirects.html