Adding a URL to urls.py


#1

I cannot seem to get past the steps in chapter 4. I get the following error, but nothing seems to be incorrect. Here is the error, and here is the code.

Error:

Code:

from django.conf.urls import patterns, url
from django.contrib import admin
from collection import views

urlpatterns = [
url(r’^$’, views.index, name=‘home’),
url(r’^admin/’, include(admin.site.urls)),
]


#2

@limedaring Any thoughts or suggestions?


#3

For anyone with the same problem, I have fixed it with this line of code.

from django.conf.urls import include

however that line of code is not mentioned in the book. Not sure why. :(


#4

:( Might be a typo. When did you get your book and where? Sorry for the trouble, glad you figured out the problem!

(Sorry for not answering quickly enough, I have a full-time job now in addition to my HWA and another side project so my time available just dropped drastically. 😰)


#5

Hey @limedaring I got the book from Gumroad, it is version 1.1. Is there an updated version with corrections I can download? Thanks for the help!


#6

add this in top: from django.conf.urls import include


#7

I’m going to do a new release of the files and make sure that’s in it. There are so many versions of the books on Gumroad now because of the different packages that I’m just going to refresh them all. @Kitty can you email me [email protected] and I’ll send you the files directly?