Using a template.

From MyWiki
Revision as of 10:53, 19 March 2021 by George2 (Talk | contribs)

Jump to: navigation, search

Starting with the hello app on line 3 make a modification to the default route in the views.py file:

Replace
def index(request):
    return HttpResponse("Hello!")

with

def index(request):
    return render(request, "hello/index.html")

Now we need to create the template file in a folder called "templates" in the "hello" folder