Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have a project with several views e.g. - index, contacts and about. And I want url www.aaa.net links to index view, www.aaa.net/about to about view and so on In project urls.py I wrote

url(r'^$', include('mysite.urls'))

In app urls.py I wrote

url(r'^$',views.index,name='index'),
url(r'about/$',views.about,name='about'),
url(r'contacts/$',views.contacts,name='contacts'),

But it works only with index view, about and contacts didn't work at all

share|improve this question

1 Answer

up vote 3 down vote accepted

Remove the $ at the end of

url(r'^$', include('mysite.urls'))

When you are trying to include, $, in the regex match implies the end of the url pattern, which was the cause of the issue.

You are probably looking for

url(r'^', include('mysite.urls'))

More info on including URL patterns here

share|improve this answer
With '^/' it doesn't work at all – vZ10 Jul 12 at 3:42
It is your settings most likely try the update – karthikr Jul 12 at 10:31
Yahooo!!! Now it works, thank you!!! – vZ10 Jul 12 at 18:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.