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 Model Administration Django's Admin

Christopher Shaw
seal-mask
PLUS
.a{fill-rule:evenodd;}techdegree seal-36
Christopher Shaw
Python Web Development Techdegree Graduate 58,248 Points

Include not imported in urls.py

Just a note for a small issue and solution I had in the video.

My admin site came up 'Not available' after logging in as the superuser, but no error was displayed in the console. After comparing my code to the video, I noticed that when my 'learning_site' was created, include had not been imported, as it was in the video, and that the url for admin did not have the 'include'.

Before - Gave error

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

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

After - Working

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

urlpatterns = [
    url(r'^admin/', include(admin.site.urls)),
]

2 Answers

__ROLLER__ Angel
__ROLLER__ Angel
25,606 Points

This was discussed in the teacher's notes...