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

For Django 2.0.3 and up...

So, this is for anyone using Django 2.0.3 and up. I found the syntax to be a bit different.

# original
from django.conf.urls import include, url
from django.contrib import admin

from . import views

urlpatterns = [
    url(r'^courses/', include('courses.urls')),
    url(r'^admin/', admin.site.urls),
    url(r'^$', views.hello_world),
]
# for Django 2.0.3 using the 'path' import
from django.urls import include, path
from django.contrib import admin

from . import views

urlpatterns = [
    path('courses/', include('courses.urls')),
    path('admin/', admin.site.urls),
    path('', views.hello_world),
]

1 Answer

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,441 Points

Thanks! Treehouse is in the process of updating the course content to Django 2.0