Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Django Basics Django Templates Templates

Shana HT
Shana HT
3,292 Points

get an error when I try to this lesson myself

I am trying to do this lesson as he is teaching. I run into this error when I go to http://localhost:8000/courses/, after setting up everything the way the lesson explains

*** this from the web browser***
Using the URLconf defined in learning_site.urls, Django tried these URL patterns, in this order:
^courses/ ^course_list
^admin/
^$
The current URL, courses/, didn't match any of these.

Where do I look to fix this error?

from my courses/urls.py file:

urlpatterns = [

    url(r'^course_list', views.course_list),
]

from my learning_site/urls.py file:

urlpatterns = [

    url(r'^courses/', include('courses.urls')),
    url(r'^admin/', include(admin.site.urls)),

    url(r'^$', views.hello_world )
    ]
Ricardo Lousada
Ricardo Lousada
7,487 Points

Did you import include? in the urls file? If not you should do it like this:

from django.conf.urls import url, include

Sergio Cruz
Sergio Cruz
15,550 Points

In your courses urls.py your regex should be r'^$' not r'^course_list'