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 What a View! First URL

"Check work" doesn't recognize that I've imported views

I have the line:

from . import views

However, when I check my work, it keeps failing with the text, "Did you import views?"

I don't understand what I'm doing wrong because this is the exact line that is working properly in my project, so why does it think I'm not importing the views?

newspaper/urls.py
from django.conf.urls import url
from . import views

urlpatterns = [
    url(r'^$', views.hello_world),
]

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! I agree that this particular Bummer message might be a bit misleading. The problem here really is not in your import statement, but rather in your url_patterns. You are trying to get the view hello_world which likely doesn't exist in this context. The challenge asks you to get the view index. Simply switching out hello_world for index will cause this to pass.

Hope this helps! :sparkles:

Yes, thanks! I figured out that I jumped ahead of what they expected by adding that url. I wish they had either better error messages, or just ignored any extraneous url definitions.

Once I deleted it, it passed. I couldn't figure out how to get back to this question to update it and say that I figured it out.