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.
Nthulane MakgatoCourses Plus Student 19,602 Points
Class Based Views URL
Struggling to find the last part of this question. I know that the answer is easy but I still haven't gotten it right. Please help.
The bigger problem though is that i've recently been struggling to find help on the "Treehouse Community" as in I can't find similar questions and learn from them. I'm convinced that I would have solved this much quicker than have to wait for a response. I usually copy and paste part of the task or the task name("Basic Views") but recently there haven't been many similar questions. Are people just coasting through these tasks, am I using it wrong, has the search algorithm changed or what?
Please help on one or both.
from django.conf.urls import url, include from . import views urlpatterns = [ url('/', views.WelcomeView.as_view(), name='/') ]
from django.views.generic import View from django.http import HttpResponse class WelcomeView(View): def get(self, request): return HttpResponse("Hello")
Henrik ChristensenPython Web Development Techdegree Student 38,322 Points
You're very close! The problem is in the url. He is asking you to make the path "/" which would be something like this:
from django.conf.urls import url, include from . import views urlpatterns = [ url(r'^$', views.WelcomeView.as_view()) # name="" is not required in this task ]
I remember it being really hard to find solutions about django when I went through the course. I prefer searching through the django-docs since it's somewhat easy to find what you're looking for + the django-docs are just amazing imho! :-D
https://docs.djangoproject.com/en/1.11/ (this is for django v. 1.11 - just change the version number to the version you're using)
Keep on coding! :-D