Google应用引擎重定向到绝对的uri

Jes*_*ent 5 google-app-engine redirect

我正在使用谷歌应用程序引擎与python和webapp2,我找不到只是使用绝对uri重定向到外部网站的方式.

例如:

class Landing(BaseHandler):
    def get(self):     
        self.render("landing.html")

    def post(self):
        name=self.request.get("name")
        if name == "yes"
            self.redirect("/")
        else:
            self.redirect("http://example.com") **This is the problem as I want to redirect to an absolute url.
Run Code Online (Sandbox Code Playgroud)

self.redirect始终重定向到相对URL.我怎么能重定向到绝对URL?我认为它必须容易,但我找不到方法.

Jim*_*ane 2

对我来说效果很好,不仅重定向 到相对网址。请检查您的主机、浏览器和缓存的配置。

GAE 刚刚将我重定向到 example.com,在我的开发和生产服务器上使用它

请注意,example.com 会重定向到http://www.iana.org/domains/example/

这可能会让你感到困惑。

尝试使用例如self.redirect("http://www.facebook.com")。这会将您重定向到 Facebook。简单的。