Reputation: 9392
I've already seen the documentation here and I am trying to do the same thing but it is not working. It is not matching the urls.
Here is my urls.py
profile_patterns = patterns('',
url(r'^profile/$', views.profile),
url(r'^thoughts/$', views.thoughts),
)
urlpatterns = patterns('',
url(r'^/user/(?P<username>\S+)/', include(profile_patterns)),
# I also tried to do it this way.. But it isn't working.
url(r'^abc/', include(patterns('',
url(r'^hello/$', views.profile)))),
I tried to access the following urls.
'http://<mysite>.com/user/<someUsername>/profile/'
'http://<mysite>.com/abc/hello/'
Upvotes: 3
Views: 648
Reputation: 37846
try this \w+
instead of \S+
and not ''
but the path to user views:
profile_patterns = patterns('userapp.views',
url(r'^profile/$', profile),
url(r'^thoughts/$', thoughts),
)
urlpatterns = patterns('',
url(r'^/user/(?P<username>\w+)/', include(profile_patterns)),
)
Upvotes: 3