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! HttpResponse

Joshua Kozlowski
Joshua Kozlowski
14,117 Points

how do I make a new view?

I thought it wanted me to make a new view named index/views.py but i don't see a was to add a new file.

newspaper/views.py
from django.http import HttpResponse

1 Answer

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Joshua;

That code should have gotten you through Task 1.

Task 2 is looking for you to create (code) a new view in the views.py file. If you remember from the videos the boilerplate code for creating a new view in Django is:

def view_name(request):
    # You can do something here for your view
    return #This is what needs to be returned...

The task is asking us to return a basic string through the HttpResponseobject. Check the video again if you have forgotten how to accomplish that.

Happy coding and post back if you are still stuck.

Ken