My home.html in div where I called the { data } to display in HTML
<div id= "main">
<h1> DATA SCRAPPER</h1>
<h2>Header Data from html Page</h2>
{ data }
</div>
But in terminal it is showing the scrapped data
Views.py where
def home(request):
soup= None
URL = 'https://www.abc.html'
page = requests.get(URL)
soup = bs(page.content, 'html.parser')
print(soup.h1.text)
head=soup.h1.text
return render(request, 'home.html', {'data': head})
CodePudding user response:
You're just missing some curly braces.
You need:
{{ data }}
not
{ data }
CodePudding user response:
For displaying variable data you have to use double bracket
{{data}}
CodePudding user response:
<!doctype html>
<html>
<head>
<title>code </title>
</head>
<body>
<div id="main">
<h1> data </h1>
<h2> header data from html </h2>
{{data}}
</div>
</body>
</html>