Django: Multiple url patterns starting at the root spread across files

戏子无情 提交于 2019-11-30 11:16:35
Daniel Roseman

Sure. URLs are processed in order, and two includes can have the same prefix - if one doesn't succeed in matching, processing will just move on to the next one.

urlpatterns = patterns('',
    url(r'^user/', include('registration.urls')),
    url(r'^user/', include('profile.urls')),
)

Also i suggest to add a namespace like this:

urlpatterns = patterns('',
    url(r'^user/', include('registration.urls', namespace="registration")),
    url(r'^user/', include('profile.urls', namespace="profile")),
)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!