django 1.6 tutorial3 "current url doesn't match any pattern"

166 Views Asked by At

Python 2.7.3

I am new in django and I am following the tutorial at : https://docs.djangoproject.com/en/1.6/intro/tutorial03/

I followed exactly the steps described:

Here is a copy/paste from files in the project:

cat polls/views.py

from django.http import HttpResponse

def index(request):
        return HttpResponse("Hello, world. You're at the poll index.")

from /mysite: cat urls.py

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

from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    url(r'^polls/', include('polls.urls')'),
    url(r'^admin/', include(admin.site.urls)'),
)

cat polls/urls.py

from django.conf.urls import patterns, url

from polls import views

urlpatterns = patterns('',
    url(r'^$', views.index, name='index')
)

The page debug shows the following error: enter image description here

It looks like, it doesn't recognize the "polls" pattern in /mysite/urls.py.

Am I missing something?

1

There are 1 best solutions below

0
On

I think the problem is at

url(r'^polls/', include('polls.urls')'),

Change it to: (From the docs at https://docs.djangoproject.com/en/1.6/intro/tutorial03/)

url(r'^polls/', include('polls.urls')),