我如何引用Django 1.5 URL中的;命名为;在包含的URL文件中?
我的项目的主URL.py文件包含以下内容:我如何引用Django 1.5 URL中的;命名为;在包含的URL文件中?,django,django-templates,Django,Django Templates,我的项目的主URL.py文件包含以下内容: url(r'^accounts/$', include('accounts.urls'), urlpatterns = patterns('accounts.views', url(r'^profile/$', 'accounts_profile', name='accounts_profile'), 在accounts.url.py中,我有以下内容: url(r'^accounts/$', include('accounts.urls
url(r'^accounts/$', include('accounts.urls'),
urlpatterns = patterns('accounts.views',
url(r'^profile/$', 'accounts_profile', name='accounts_profile'),
在accounts.url.py中,我有以下内容:
url(r'^accounts/$', include('accounts.urls'),
urlpatterns = patterns('accounts.views',
url(r'^profile/$', 'accounts_profile', name='accounts_profile'),
在我的base.html模板中,我有:
<li><a href="{% url 'accounts_profile' %}">Profile</a></li>
如果我将accounts\u profile url定义移动到main url.py,url就会工作。我记得这种风格的URL组织在以前的Django版本中工作;有什么改变了,或者我做错了什么吗?去掉
url(r'^accounts/$),include('accounts.url'),
调用中的$
请注意,本例中的正则表达式没有$(字符串结尾匹配字符),但包含尾部斜杠
在这里,我想Django 1.5可以改变一切!感谢您的帮助!