有人知道如何使用include参数对url进行反向url查找吗?例如,我有以下网址:
url(r'^photos/', include('photos.urls'), name="photos"),
在我看来,我想访问它如下
def photos_redirect(request, path):
return HttpResponsePermanentRedirect(reverse('photos') + path)
但它得到了以下错误:
Reverse for 'photos' with arguments '()' and keyword arguments '{}' not found.
您必须反转到一个单独的url模式。photos
URL模式包括photos.urls
中的所有URL模式,因此您必须选择要指向的单个URL。