在Django,我已经准备好了网址.py如下所示:
url(r'^example/$', ExampleView.as_view(), name='example'),
url(r'^example2/$', AnotherView.as_view(), name='example2'),
其中“example2”应该是:'http://localenv.com/example2'。在
在我的视图.py,我想返回对“example2”链接的引用。让我解释一下:
^{pr2}$我希望print语句返回“http://localenv.com/example2”
有什么帮助吗?在
您将要使用^{} 。在
编辑:
如果需要绝对uri,可以使用^{} 构建它
^{pr2}$你可以看看urlresolvers。但是它只提供URI,您必须手动添加“http://localenv.com…”。在
相关问题 更多 >
编程相关推荐