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

Benjamin Guyton
Benjamin Guyton
6,858 Points

ViewDoesNotExist at /courses

I continue to have an error thrown when i try to run the server at /course or /admin. I removed include() from urls.py which created a strange warning line in the console, but allowed the code to proceed. But upon adding include() back in, it failed in the console. Would love the help, I really can't proceed here without access to the server and I don't know what in the code is preventing it from properly running.

4 Answers

Haydar Al-Rikabi
Haydar Al-Rikabi
5,971 Points

You have to import include as follows: from django.urls import include

Then use it to wrap courses.urls as follows: include('courses.urls')

Hasan Ahmad
Hasan Ahmad
6,727 Points

show us the urls.py

Benjamin Guyton
Benjamin Guyton
6,858 Points

from django.conf.urls import url from django.contrib import admin

from . import views

urlpatterns = [ url(r'^courses/', 'courses.urls'), url(r'^admin/', admin.site.urls), url(r'^$', views.hello_world), ]

Hasan Ahmad
Hasan Ahmad
6,727 Points

what happens when you wrap 'courses.urls' in the include function?

Benjamin Guyton
Benjamin Guyton
6,858 Points

The console returns an excessive number of errors and wont run the server

Hasan Ahmad
Hasan Ahmad
6,727 Points

do you have a urls.py file in the courses app?