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

I am wondering if it is possible to have the standard url patterns spread across multiple files (in this case the project-wide and several apps-specific

Imagine that the project look like this (got this working):

from django.conf.urls import patterns, include, url

urlpatterns = patterns('',
    url(r'^user/signup/', 'registration.views.signup'),
    url(r'^user/confirm/(?P<code>\w{20})/', 'registration.views.confirm'),
    url(r'^user/profile/(\d+)/', ''),
    url(r'^user/profile/edit/', 'profile.views.edit'), 

As you can see, I have two different apps that both want to user the urls for /user/*, so I can't just use r'^user/' with an include.

My question is: Can I split the above into two seperate files, that each go into their respective app?

Note: Disregard any syntax mistakes as this was typed in


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

Need Your Help

How do I change the Z-Order of sprites?

objective-c cocos2d-iphone z-order

I want to set the Z-order of the sprites I create in Objective-C, specifically in Cocos2D.

What is an activity, a context and an intent in Android?

android definition

Can somebody please explain to me what an activity, a context and an intent in Android are?