Difference between revisions of "Using a template."
From MyWiki
Line 8: | Line 8: | ||
return render(request, "hello/index.html") | return render(request, "hello/index.html") | ||
</source> | </source> | ||
− | Now we need to create the template file in a folder called "templates" in the "hello" folder<br> | + | Now we need to create the template file in a folder called "templates" in the "hello" folder.<br> |
+ | Create the templates folder.<br> |
Revision as of 13:00, 19 March 2021
Starting with the hello app on line 3 make a modification to the default route in the views.py file:
Replacedef 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.
Create the templates folder.