Skip to content
Justice Tech School

Your First View

A view is a Python function that takes a request and returns a response. Put it in views.py.

Example
# blog/views.py
from django.http import HttpResponse

def index(request):
    return HttpResponse("Hello, world. You are at the blog index.")

Exercise

What does a view receive?

def index():

Quiz Test

What does a view return?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.