Reputation: 3068
I have the following in my project urls:
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
url(r'^$', include('myapp.urls')),
url(r'^login$', user_login, name='login'),
url(r'^logout$', user_logout, name='logout'),
)
and i had the following in my app urls:
urlpatterns = patterns('',
url(r'^$', views.DefaultView.as_view(), name='default'),
url(r'^register/$', views.CustomerRegister, name='customerregister'),
)
The default view loads up fine but the Register url is not working. I tried the following links:
localhost:8000/
localhost:8000/register
Upvotes: 0
Views: 96
Reputation: 2958
url(r'^$', include('myapp.urls')),
should be url(r'', include('myapp.urls')),
Note that the ^
matches the start of the string, and the $
matches the end of the string, so ^$
will only match an empty string (usually used for the index). Similarly, notice the admin url does not end with a $
.
Upvotes: 2