如何在googleappengine中获取主机名?

2024-10-01 17:36:25 发布

您现在位置:Python中文网/ 问答频道 /正文

我在googleappengine上用Python开发一个应用程序 http://shs1509-grc.appspot.com/
而且由于我在中国,appspot被阻止,我的用户必须使用主机名http://shs1509-grc.appsp0t.com/来访问我的应用程序。
问题是,当我使用self.redirect("/something")时,我的用户将被重定向到appspot,他们无法访问它,
但是如果使用self.redirect("http://shs1509-grc.appsp0t.com/something"),直接访问appspot的用户会被重定向到appspott,速度比较慢,而且我在本地调试会很麻烦。
我想我可以用self.request.host来解决这个问题,以获取访问者来自哪个主机名,但是它的值似乎仍然是shs1509-grc.appspot.com,即使我是从appsp0t访问的。
有什么解决办法吗?提前谢谢。在


Tags: 用户selfcom应用程序http重定向redirectsomething

热门问题