Django Templates
====================================================================================
9: Django Templates
===================================================================================
if we check view.py , there is some html code; but we do not write all code of HTML here; Therefore we used templete
1) click on project> create directory>(template)
right click on directory and create HTML files called Home
2)
<html lange="en">
<head>
<meta Charset ="UTF-8">
<title> Home </title>
</head>
<h1/> This is our home page</h1>
<h1/> Welcome to our home page</h1>
<body>
<h1></h1>
</body>
</html>
3)
Now again click on view.py
and write the following sentance
def Home(request)
return render(request,'home.html')
4 ) next steps
open setting.py
TEMPLATES =[
'DIRS': ['template']
Now you open
http://127.0.0.1:8000/