Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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?

from django.conf.urls import url
from . import views

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

1 Answer

Jennifer Nordell
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.