Solution 1 :

Nothing seems wrong with what you are trying to do. This could likely be caused due to a number of other reasons, mainly any of the followings:

  • I think that the reference to the base template is relative to you
  • TEMPLATE_DIR. Try different things like putting both templates at the
    same level etc.

  • Check all the tags in both templates to be sure that they are all
    correctly formatted

  • Check the encoding of the files. If it is UTF-8, try to disable the
    BOM in both files.

  • Maybe it is a problem with your directory setting. Try to hard code
    the absolute path to check that

My guess would be the final point.

Problem :

I have error in my template when I try to use inheritance block
Everything works before I convert the login.html into html, which is basically everything from base.html

My html files are as below´╝Ü

base.html :

<!DOCTYPE html>
        {% block head %}
        <title> {% block title %} {% endblock %} | Company Name</title>
        {% endblock %}

        {% block body}

        {% endblock %}

login.html :

{% extends "base.html" %}

{% block title %}Login{% endblock %}

{% block body %}
  <form method="POST">
    <label for="name_question">What is your name? <br>
    <input type="text" name="name"> <br>
    <input type="submit" name="submit" value="Submit"> <br>

  {% if name %}
    <h1>Hello, {{name}}!</h1>
  {% endif %}

{% endblock body %}


Comment posted by AzyCrw4282

What is the problem here? Are you saying that the

Comment posted by zhouong

apparently its because I wrote {% block body} instead of {% block body %}. Guess syntax do really screw me up haha