Read Time:36 Second
Django Views
Django views are Python functions that takes http requests and returns http response, like HTML documents.
A web page that uses Django is full of views with different tasks and missions.
There is a views.py in your example folder that looks like this:
from django.shortcuts import render # Create your views here.
Find it and open it, and replace the content with this:
from django.shortcuts import render from django.http import HttpResponse # Create your views here. def members(request): return HttpResponse("Hello world!")
This is a simple example on how to send a response back to the browser.
But how can we execute the view? Well, we must call the view via a URL.
Average Rating