Django template includes + extends

This is my Directory Tree.

base.html:

{% load static %}
<!DOCTYPE html>
<html lang="en">
{% include 'weapons/head/head.html' %}
{% include 'weapons/body/body.html' %}
</html>

body.html:

{% load static %}
<body>
    {% block content %}{% endblock content %}
</body>

home.html:

{% extends 'weapons/base/base.html' %}

{% block content %}
<span>Hello!</span>
{% endblock content %}

When I visit my home.html, it doesn't appear to be working correctly. I see nothing on my page, however the "Hello!" message is expected to be shown. What is the problem?

Your base {% block content %} must be in base.html else it won't be usable by home.html.

base.html:

{% load static %}
<!DOCTYPE html>
<html lang="en">
{% include 'weapons/head/head.html' %}
<body>
{% block content %}
{# Leave it empty or add a default content that can be overwritten by other templates #}
{% endblock content %}
</body>
</html>
Back to Top