Reputation: 2676
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
Upvotes: 2
Views: 4300
Reputation: 99620
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
Upvotes: 6