New ERORR TemplateDoesNotExist at index.html in Django python 3

I am new to Django and when I run the project I get an error Unfortunately, previous questions did not solve my problem.

TemplateDoesNotExist at /
blog/index.html

This is my folder structure:

country/
    urls.py
    wsgi.py
    settings.py
blog/
    migrations/
    templates/
        blog/
           index.html
    admin.py
    models.py
    tests.py
    urls.py
    views.py
manage.py

urls blog :

from django.urls import path
from . import views
app_name = 'blog'
urlpatterns = [
path('', views.index, name='index'),
]

views blog

from django.shortcuts import render   
def index(request):
    return render(request,'blog/index.html')

settings

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, 'templates')],
        'APP_DIRS': True,
        //snip
    },
]

INSTALLED_APPS = [
    'blog',
    //snip
    
]

To solve this problem, after creating the template folder, I ran the migrate command once and the problem was solved

python manage.py migrate
Back to Top