Routing subdomains in Pyramid

Deadly 提交于 2019-12-01 18:39:13

问题


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'))

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


回答1:


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




回答2:


An example of what @syrion is referring to is available here:

Multiple domains and subdomains on a single Pyramid instance



来源:https://stackoverflow.com/questions/5274813/routing-subdomains-in-pyramid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!