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

50👍

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')),
)

8👍

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")),
)
👤iDevPy

Leave a comment