views:

63

answers:

1

What I'm trying to do:

# urls.py
urlpatterns = patterns('',
    (r'^info/(?P<user>[-\w+])/(?P<app>[-\w+])/', include(%app%.urls)),
)

which should display specific information that given user entered for the app. And I want the URL scheme to stay this way. Is it even possible? I think namespaces would do the trick but official documentation is too sparse and lacks good examples.

Can someone shed some light on this issue?

+1  A: 

If I understand correctly, you're trying to dynamically include a different urlconf depending on the value of the 'app' element in your url.

I don't see what namespaces have to do with this. Quite simply, there's no way to do it. Urlconfs are compiled at startup, so can't include different things dynamically.

The only way to approach what you want is to have specific urls for each value of app, each including the relevant urlconf.

Daniel Roseman