Django Views are one of the vital participants of the MVT Structure of Django. As per Django Documentation, A view function is a Python function that takes a Web request and returns a Web response. This response can be the HTML contents of a Web page, a redirect, a 404 error, an XML document, an image, or anything that a web browser can display.
Read template directory post first then start this.
views.py from django.shortcuts import render, HttpResponse # Create your views here. def index(request): return render(request, 'index.html')
Pass the varibale from router to templates
def index(request):
obj = {
'variables' : 'this is test variable',
}
return render(request, 'index.html', obj);
templates/index.html:
{{ variables }}