Django Urlpattern "didn't Match"
I have the following code in my urls.py: urlpatterns = patterns('', (r'^news/', include('news.urls')), ) When I try to open http://localhost/news or http://localhost/news/
Solution 1:
Looks like you forgot the url()
function:
Try this instead:
from django.conf.urls import url
urlpatterns = patterns('',
url(r'^news/', include('news.urls')),
)
and news/urls.py:
from django.conf.urls.defaults import *
from django.views.generic.simple import direct_to_template
from django.conf.urls import url
urlpatterns = patterns('news.views',
url(r'^$', 'news'),
)
Solution 2:
In which port your application launches? When I see your tries http://locahost/news
it might be that you forgot to use the right port.
Try to visit http://localhost:8000/
and http://localhost:8000/news
.
Solution 3:
I think it may be a problem with your views.py this url on the django docs tells you how to dispatch the urls properley
Post a Comment for "Django Urlpattern "didn't Match""