Django framework uses error reporting exception type: templatedoesnotexist

1、 Error: templatedoesnotexist

Exception Type: TemplateDoesNotExist

 

2、 Problem analysis and solution

Problem analysis: the accessed HTML file was not found

reason:

Django directly regards the template path as an absolute path, and the HTML file cannot be found.

After viewing the project setting file, you can see the setting method of template, including an option of “dirs”,
 

Solution:

'DIRS': [os.path.join(BASE_DIR), 'templates'],

Read More: