Django: Having trouble with nesting URLS

31 views
Skip to first unread message

ApathyBear

unread,
Mar 27, 2014, 7:35:04 PM3/27/14
to django...@googlegroups.com

I posted this on stack, but I feel like I would get better help here:

I am trying to connect my urls together after installing the django-registration app via pip install. 

My main project is called Club , here is club/club/urls.py:

from django.conf.urls import patterns, include, url
from blog import views
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    # Examples:
    # url(r'^$', 'club.views.home', name='home'),
    # url(r'^club/', include('club.foo.urls')),

    # Uncomment the admin/doc line below to enable admin documentation:
    # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    url(r'^admin/', include(admin.site.urls)),
    url(r'^addauthor$', views.addauthorView),
    url(r'^thanks/$', views.thanksView),
    url(r'^displayauthors/$', views.displayauthors),
    # registration links below
    url(r'^reg/', include('club.registration.urls')),

)   

And here is my club/registration/urls.py:

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

urlpatterns = patterns('',
url(r'^accounts/', include('registration.backends.default.urls')),
)

Am I connecting these two correctly? Or is there another way to do it?

When trying to visit http://127.0.0.1:8000/reg/accounts/login/ in browser I get an error message:

ImportError at /reg/accounts/login/
No module named registration.urls

Kelvin Wong

unread,
Apr 2, 2014, 1:49:59 AM4/2/14
to django...@googlegroups.com
You might try this

# settings.py

INSTALLED_APPS += ('registration',)

# urls.py -- In appropriate section

url(r'^accounts/', include('registration.backends.simple.urls')),
Reply all
Reply to author
Forward
0 new messages