title: raise TemplateDoesNotExist(template_name, chain=chain)
body: <pre><code>Traceback (most recent call last):
  ....
  raise TemplateDoesNotExist(template_name, chain=chain)
  django.template.exceptions.TemplateDoesNotExist: None
  </code></pre>
  
  <p>Django project.</p>
  
  <p>settings.py</p>
  
  <pre><code>TEMPLATES = [
  {   ...
      'DIRS': [ os.path.join(BASE_DIR, 'templates')],}, 
    ...]
  </code></pre>
  
  <p>path in project tree: blog/template/blog (here all .html files)</p>
  
  <p>blog/views.py</p>
  
  <pre><code>from django.views.generic import View
  from django.shortcuts import render
  from django.shortcuts import get_object_or_404
  from .models import Post, Tag
  from .utils import ObjectDetailMixin
  
  def posts_list(request):
     posts = Post.objects.all()
     return render(request, "blog/index.html", context={'posts':posts})
  
  
  class PostDetail(ObjectDetailMixin, View):
     model = Post
     tamplate = 'blog/post_detail.html'
  
  class TagDetail(ObjectDetailMixin, View):
     model = Tag
     template = 'blog/tag_detail.html'
  
  def tags_list(request):
     tags = Tag.objects.all()
     return render(request,'blog/tags_list.html',
     context={'tags': tags})
  </code></pre>
  
  <p>blog/utils.py</p>
  
  <pre><code>from django.shortcuts import render
  from django.shortcuts import get_object_or_404
  from .models import *
  
  class ObjectDetailMixin:
      model = None
      template = None
  
  def get(self, request, slug):
      obj = get_object_or_404(self.model,
      slug__iexact=slug)
      return render(request, self.template,
      context={self.model.__name__.lower():obj})
  </code></pre>
  
  <p>urls.py </p>
  
  <pre><code>from django.contrib import admin
  from django.urls import path, include
  
  
  urlpatterns = [
      path('admin/', admin.site.urls),
      path('blog/', include('blog.urls')),
  ]
  </code></pre>
  
  <p>blog/urls.py</p>
  
  <pre><code>from django.urls import path
  from .views import *
  
  urlpatterns = [
      path('', posts_list, name='posts_list_url'),
      path('post/&lt;str:slug&gt;/', PostDetail.as_view(), 
  name='post_detail_url'),
      path('tags/', tags_list, name='tags_list_url'),
      path('tag/&lt;str:slug&gt;', TagDetail.as_view(), name='tag_detail_url')
   ]
  </code></pre>
  
  <p>blog/models.py</p>
  
  <pre><code>from django.db import models
  from django.shortcuts import reverse
  # Create your models here.
  class Post(models.Model):
      title = models.CharField(max_length=150, db_index=True)
      slug = models.SlugField(max_length=150, unique=True)
      body = models.TextField(blank=True)
      tags = 
      models.ManyToManyField('Tag',blank=True,related_name='posts')
      date_pub = models.DateTimeField(auto_now_add=True)
  
     def get_absolute_url(self):
         return reverse('post_detail_url', kwargs={'slug':self.slug})
  
     def __str__(self):
         return self.title
  
   class Tag(models.Model):
       title = models.CharField(max_length=50)
       slug = models.SlugField(max_length=50,unique=True)
  
       def get_absolute_url(self):
           return reverse('tag_detail_url', kwargs={'slug': self.slug})
  
       def __str__(self):
           return self.title
  </code></pre>
  
  <p>post_card_template.html </p>
  
  <pre><code>&lt;div class="card mb-4"&gt;
  &lt;div class="card-header"&gt;
    {{ post.date_pub}}
  &lt;/div&gt;
  &lt;div class="card-body"&gt;
    &lt;h5 class="card-title"&gt;{{post.title}}&lt;/h5&gt;
    &lt;p class="card-text"&gt;{{post.body|truncatewords:10}}&lt;/p&gt;
    &lt;a href="{{ post.get_absolute_url }}" class="btn btn-light"&gt;Read&lt;/a&gt;
  &lt;/div&gt;
  &lt;div class="card-footer text-muted"&gt;
    Tags:
    {% for tag in post.tags.all %}
      &lt;a href="{{ tag.get_absolute_url }}"&gt; {{ tag.title }}&lt;/a&gt;
    {% endfor %}
   &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p>Can you help me fix problem ? Please </p>