Unlike views.py, you need to create different files for each view. This lesson will explain how to prepare the template html files.
In Chapter 2, we already explained about the templates directory. This part is a recap of what we have already explained.
startproject
command won't create the directory)As you may need HTML template files for other apps under the same project, it is better to create a subdirectory for the app-specific template files.
Create HTML files for each generic view. The illustration below is an example of template files and directory structure – five HTML files are under the app_a directory.
In this practice, we'll create five HTML files for each of the following views created in a previous section.
We already created the templates directory in Chapter 2. Create a subdirectory named employee_learning under the templates directory. You can create a subdirectory with a right-click on the templates directory in VS code. Or go to the templates directory in your terminal and run the mkdir
command.
mkdir employee_learning
The directory structure will be like the one below.
Create the following five HTML files
The directory and file structure will be like the one below.
Add <h1> Page Name </h1>
to prepare for the practices in the following sections. For example, <h1>LIST Page</h1>
in course_list.html.
<h1>LIST Page</h1>
Unlike views.py, you need to create different files for each view. This lesson will explain how to prepare the template html files.
In Chapter 2, we already explained about the templates directory. This part is a recap of what we have already explained.
startproject
command won't create the directory)As you may need HTML template files for other apps under the same project, it is better to create a subdirectory for the app-specific template files.
Create HTML files for each generic view. The illustration below is an example of template files and directory structure – five HTML files are under the app_a directory.
In this practice, we'll create five HTML files for each of the following views created in a previous section.
We already created the templates directory in Chapter 2. Create a subdirectory named employee_learning under the templates directory. You can create a subdirectory with a right-click on the templates directory in VS code. Or go to the templates directory in your terminal and run the mkdir
command.
mkdir employee_learning
The directory structure will be like the one below.
Create the following five HTML files
The directory and file structure will be like the one below.
Add <h1> Page Name </h1>
to prepare for the practices in the following sections. For example, <h1>LIST Page</h1>
in course_list.html.
<h1>LIST Page</h1>