【发布时间】:2012-02-08 03:20:05
【问题描述】:
比如我有一个django项目,有两个页面。
http://domain.com/A/things
http://domain.com/B/things
现在我希望访问者可以通过 url 访问这些页面
http://A.domain.com/things
http://B.domain.com/things
我尝试使用 nginx 重写规则。比如将“http://A.domain.com/things”改写成“http://domain.com/A/things”。
但是当我使用函数 reverse 或 templatetag url 时,url 仍然是 "/A/things" 而不是 "http://A.domain.com/things" em>
我们知道,django 会根据 url 调度对视图的访问。不知道有没有办法让django基于域进行分派访问?
【问题讨论】: