[PYTHON] Django TemplateDoesNotExist at / is out! (Simple but addicted to half a day!)

■ Environment

windows10  Pycharm Community 2019.3  Python3.7  Django 3.03

■ Prerequisites

It is assumed that you are creating a Django project and application. See below Until you create a Django application in the terminal

■ Event

When I went to read index.html, "TemplateDoesNotExist at /" It comes out, and index.html does not come out!

image.png

■ I tried it, but it didn't work

I researched various things and tried the following, but it didn't change ...

① Modify TEMPLATES = in setting.py as follows

'DIRS': [],   ↓  'DIRS': [BASE_DIR, "templates"],

(2) Modify TEMPLATES = in setting.py as follows

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

■ Cause

In the first place, this error, does the file exist? Error that the file cannot be read.

Looking at the previous error

image.png

I want to read index.html, but I can see that it is displayed as index \ html.

If you look at view.py, you can see that it is index \ html.

image.png

index/html → index.html

After changing to, the error disappeared.

It was a basic one (crying).

that's all

Recommended Posts

Django TemplateDoesNotExist at / is out! (Simple but addicted to half a day!)
A story that I was addicted to at np.where
To myself as a Django beginner (2) --What is MTV?
Day 68 [Introduction to Kaggle] Random Forest was a simple one.
VIM is good to use — at least a sneak peek
Rails users try to create a simple blog engine with Django
Django: What to do if TemplateDoesNotExist at / admin / after setting templates