Hi,

I've tried to understand how to write an urls module for reusable app and I 
think I have it correctly:

# myapp.urls
app_name = 'myapp'
urlpatterns = [
    url(r'^index/$', MyIndexView.as_view(), name='index'),
    url(r'^form/$', MyFormView.as_view(), name='form'),
    ...
]


In code I use the reverses in form 'myapp:index' and 'myapp:form'. The 
problem is, that these urls may be the only one used by the Django project, 
hence I expected ROOT_URLCONF = 'myapp.urls' should work as well. But such 
shortcut ends up in "'myapp' is not a registered namespace" error. To avoid 
that, one needs to add another urls module only to include the 
`myapp.urls`, which seems unnecessary.

Is there a reason not to use namespace from root urlconf? Can we change 
that, i.e. make root resolver to load the app_name of the root urls? Did I 
missed something else?

Regards,
Vlastimil

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/784f0a1d-2677-4246-b713-23482c61c02b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to