我想让一个子域指向app引擎中我自定义域中的特定网址,就像这样:
sub.domain.com => domain.com/sub
我在我的代码中使用DomainRoute并在生产中发布但是没有用
application = webapp2.WSGIApplication([
routes.DomainRoute('mySub.domain.com', [
webapp2.Route('/mobile', handler=ConoceMas, name='mobile-landing'),
]),
('/', MainPage),
('/(es|en|fr|de)', MainPage),
('/sendcomments', SendComments),
('/subscribe', Subscribe),
('/mobile', ConoceMas)
当我把任何子域名放到主页面时。
这段代码有什么问题?以及如何在localhost环境中证明它?
PS。 在域名掩码中我放了* CNAME配置(在godaddy admin中)
答案 0 :(得分:1)
我按照以下步骤解决此问题:
application = webapp2.WSGIApplication([
routes.DomainRoute('mySub.domain.com', [
webapp2.Route('/', handler=ConoceMas, name='mobile-landing'),
]) #entry point of the subdomain
routes.DomainRoute('mySub.domain.com', [
webapp2.Route('/(es|en|fr|de)', handler=ConoceMas, name='mobile-landing'),
]), #entry point of the subdomain with parameters
('/', MainPage),
('/(es|en|fr|de)', MainPage),
('/sendcomments', SendComments),
('/subscribe', Subscribe),
('/mobile', ConoceMas)
答案 1 :(得分:0)
您是否首先在App Engine中注册域名?它非常清楚地解释here,当我实际上必须将某些内容链接到我的自定义域时,重定向工作正常。