August 2024
Intermediate to advanced
256 pages
5h 34m
English
In the apps directory (homepage), create a new directory and name it ‘templates’. Inside the templates directory, create another directory and give it the same name as the app (in this case homepage).

Inside the homepage directory, create an HTML file and name it home.html. Open the file and add the following.
<!DOCTYPE html>
<html>
<head>
<title>Homepage</title>
</head>
<body>
<h1>Welcome to the Homepage!</h1>
<p>The current date is: {{today}}</p>
</body>
</html>
Here we’ve added a placeholder variable called ‘today’. This will be replaced by data from the function in views.py
Read now
Unlock full access