I can't expand the template django
<p>I can't expand the template <code>base.html</code> template <code>header.html</code></p>

<p>Content  <code>base.html</code></p>

<pre><code>&lt;div id="main-container"&gt;
  &lt;!-- HEADER --&gt;
  {% block header %}{% endblock %}
  &lt;!-- END HEADER --&gt;
&lt;/div&gt;
</code></pre>

<p>Content  <code>header.html</code></p>

<pre><code>{% extends "blog/base.html" %}
{% block header %}
&lt;header id="header"&gt;
***
&lt;/header&gt;
{% endblock %}
</code></pre>

<p>The output in the browser get the code:</p>

<pre><code>&lt;div id="main-container"&gt;
  &lt;!-- HEADER --&gt;

  &lt;!-- END HEADER --&gt;
</code></pre>

<p>Why not be able to extend the template?
Using <code>{% include "blog/header.html"%}</code> code inserted. using <code>extends</code> no.
Use Django 1.10.1</p>

<p><code>views.py</code></p>

<pre><code>from django.shortcuts import render
from django.utils import timezone
from .models import Post
from django.shortcuts import render, get_object_or_404

def post_list(request):
    posts = Post.objects.filter(published_date__lte=timezone.now()).order_by('published_date')
    return render(request, 'blog/index.html', {'posts': posts})

def post_detail(request, pk):
        post = get_object_or_404 (Post, pk=pk)
        return render(request, 'blog/base.html', {'post': post})

def header(request):
    return render(request, 'blog/header.html')
</code></pre>

<p>Through
<code>{% include "blog/header.html" %}</code> works. So the way spelled out correctly.</p>

<p>Thought the error here:</p>

<p><code>def header(request):
    return(request, 'blog/header.html')</code></p>

<p><code>def header(request):
    render(request, 'blog/header.html')</code></p>

<p><code>def header(request):
    return render_to_response (request, 'blog/header.html')</code></p>

<p>Not working (((</p>

<p>I think you would have confused between the include and extend in django templates. </p>

<p>Based on your file names, I assume that <code>header.html</code> is the partial which is to be included in the base.html and you are rendering <code>base.html</code> . </p>

<p>Django templating engine does not work this way.</p>

<p>Use <a href="https://docs.djangoproject.com/en/1.10/ref/templates/builtins/#include" rel="nofollow">include</a> <code>{% include "path/to/header.html" %}</code> in <code>base.html</code> and juse have the header html in <code>header.html</code>. </p>

python django templates