【问题标题】:Dynamic Subdomains with "hello world" application on Google App Engine + webbapp2Google App Engine + webbapp2 上带有“hello world”应用程序的动态子域
【发布时间】:2012-08-13 15:45:11
【问题描述】:

我有几个问题。我工作了好几天都想不通。

目标:在 Google App Engine 上动态创建子域。

我只是一个我想推荐实施的“hello world”,剩下的可以自己处理。

1-http://eqsudmoain.appid.appspot.com 书面=“eqsubdomain”

2-http://appid.appspot.com 书面=“你好世界”

我只想做这些,我需要你的帮助。 我找到了这段代码的文档,但不是动态的。

这里是代码; https://snipt.net/mehmetkose/google-app-engine-dynamic-subdomains-question/?key=7a99428d29d9aa8376158a22dbb63c94

这也是一个域名注册商使用cname你会推荐吗? 谢谢您的回答。

【问题讨论】:

    标签: python google-app-engine subdomain webapp2 cname


    【解决方案1】:

    您不能在代码中动态设置域。

    但是,您可以通过设置不同的应用版本来拥有不同的子域。这是各种版本的映射方式(注意版本是字符串而不是数字):

    http://1.appid.appspot.com   // version "1"
    
    http://eqsudmoain.appid.appspot.com   // version "eqsudmoain"
    
    http://appid.appspot.com   // default version
    

    您可以set version in app.yaml。您在 Admin - Versions 中设置默认版本。

    所以,你的建议是可能的,通过在不同版本下多次上传代码,然后使用链接中的示例代码来区分代码中的子域。

    编辑:

    您不能在*.appid.appspot.com 上拥有动态子域映射,但您可以在自己的域上拥有wildcard DNS mapping,即*.yourdomain.com。然后在代码中您可以检查主机并将请求路由到正确的代码。

    【讨论】:

    • 我要阅读文档。 app.yaml 我想用起来很有意义。就像 htaccess 一样。但我不想要一个静态子域。例如 user1.example.com 或 user1.appid.appspot.com user2.example.com 或 user2.appid.appspot.com tag2.example.com 或 tag2.appid.appspot.com tag3.example.com 或 tag3.appid。 appspot.com 我只想了解子域。 。 appid.appspot.com 处理程序只需要两个。 1. 主域处理程序。 appid.appspot.com 2.subdomainler 的处理程序subdomain.appid.appspot.com 抱歉英语不好。我正在努力。
    • GAE上没有动态子域,除了我上面提到的静态版本映射。但是,您可以拥有自己的通配符域(例如 *.yourdomain.com)映射到 appid.appspot.com:en.wikipedia.org/wiki/Wildcard_DNS_record
    猜你喜欢
    • 2013-09-14
    • 2023-03-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-13
    • 1970-01-01
    • 1970-01-01
    • 2015-11-27
    相关资源
    最近更新 更多