Pyramid 中的路由子域 [英] Routing subdomains in Pyramid

查看:47
本文介绍了Pyramid 中的路由子域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Pylons 1.0 中,我可以进入 config/routing.py 并添加

In Pylons 1.0 I could go into config/routing.py and add

map.connect('/', controller='index', conditions=dict(sub_domain=False))
map.connect('/', controller='mobileindex', conditions=dict(sub_domain='m'))

将 m.mydomain.com 路由到不同的控制器,但仍使用相同的应用程序.我可以在 Pyramid 中做同样的事情吗?

to route m.mydomain.com to a different controller, but still use the same app. Can I do the same in Pyramid?

推荐答案

理论上,这包含在 add_route() 带有 pregenerator 参数.

Theoretically, this is covered by add_route() with a pregenerator argument.

这篇关于Pyramid 中的路由子域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆