topics.html not displayed in my browser

my deposal directory for my html files is C:\learning_log\learning_logs\templates\learning_log
Directory of C:\learning_log\learning_logs\templates\learning_logs

#  My topics.html

{% extends “learning_logs/base.html” %}

{% block content %}


{% for topic in topics %}* {{ topic }}
{% empty %}* No topics have been added yet.
{% endfor %}

{% endblock content %}


""" From learning_log/learning_logs """
from django.shortcuts import render
from .models import Topic
# Create your views here.

def index(request):
    """ the home page from learning_log """
    return render(request, 'learning_logs/index.html')

#def topics(request):
#    """show all topics"""
#    topics = Topic.objects.order_by('date_added')   #date_added
#    context = {'topics':topics}
#    return render(request,'learning_logs/topics.html', context)

# ADD test 01/01/2024
def topics(request):
    """show all topics"""
    topics = Topic.objects.order_by('date_added')
    print(topics)  # Add this line for debugging
    context = {'topics': topics}
   # return render(request, 'templates/learning_logs/topics.html', context)
    return render(request, 'learning_logs/topics.html', context)

#The runserver find the data requested (200)

C:\learning_log>python runserver
Watching for file changes with StatReloader
Performing system checks…

System check identified no issues (0 silenced).
January 02, 2024 - 21:52:08
Django version 3.2.18, using settings ‘learning_log.settings’
Starting development server at
Quit the server with CTRL-BREAK.
<QuerySet [<Topic: Topic 1>, <Topic: Topic 2>]>
[02/Jan/2024 21:52:23] “GET /topics/ HTTP/1.1” 200 86

but the display on my browser is

[learning_logs]( - [topics](" }‘’’


#My contain

‘BACKEND’: ‘django.template.backends.django.DjangoTemplates’,
‘DIRS’: ,
‘APP_DIRS’: True,
‘context_processors’: [

Sseams that the data base is working fine

C:\learning_log>python shell
Python 3.11.1 (tags/v3.11.1:a7a450f, Dec 6 2022, 19:58:39) [MSC v.1934 64 bit (AMD64)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.

> > > from learning_logs.models import Topic
> > > first_topic = Topic.objects.first()
> > > print(first_topic)
> > > Topic 1
> > > specific_topic = Topic.objects.get(id=1)
> > > print(specific_topic)
> > > Topic 1 

Seams that django does not find his to display the informations to the browser screen

It’s hard to tell here in the copy that you’ve pasted here, but it looks like you might have “smart quotes” around the template name in the extends block.

Verify that your version of the template doesn’t have these types of characters in it.

It appears that your template configuration might be incorrect. The ‘DIRS’ key is expecting a corresponding value. Assign an empty list to ‘DIRS’ and provide the path to your template. This adjustment should resolve the issue you’re facing.

if you have the template folder in your project directory pass the value like this:

'DIRS': [BASE_DIR / 'templates']

and if you create template folder in your app directory your just give an empty list like this:

'DIRS': []

Django will automatically looked into your app directory.

I see in my base.html

<a href="{% url 'learning_logs:index' %}">learning_logs</a> -
<a href="{% url 'learning_logs:topics'  %}">topics</a>"           }

I will correct it into

<a href="{% url 'learning_logs:index' %}">learning_logs</a> -
<a href="{% url 'learning_logs:topics'  %}">topics</a>"           

still the same problem

I will correct m directory has proposed by Amnar

in my is now the description of the TEMPLATES

        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [

The templates are located in c:\learning_log\learning_logs\templates\learning_logs\(here is the location of the base.html ; index.html ; topics.html

I will try to change  'DIRS' : []    TO 'DIRS': [BASE_DIR / 'templates']


Like the with the first test  'DIRS' : []    every time that I click in the "topics" from the browser window there is a reaction in the runserver   :
<QuerySet [<Topic: Topic 1>, <Topic: Topic 2>]>
[03/Jan/2024 20:17:15] "GET /topics/ HTTP/1.1" 200 86   so there are a transmission of data .

I will test with  'DIRS': [BASE_DIR / 'templates/learning_logs'  because the HTML are there located

it's the same behavior !!!!!  I will look if django is really looking in the directory c:\learning_log\learning_logs\templates\learning_logs\(here is the location of the base.html ; index.html ; topics.html  with changing the name od the HTML into old_name.html

It's the goed directory because now I get

TemplateDoesNotExist at /topics/
Request Method:	GET
Request URL:
Django Version:	3.2.18
Exception Type:	TemplateDoesNotExist
Exception Value:	
Exception Location:	C:\Users\EALALIN\AppData\Local\Programs\Python\Python311\Lib\site-packages\django\template\, line 19, in get_template
Python Executable:	C:\Users\EALALIN\AppData\Local\Programs\Python\Python311\python.exe
Python Version:	3.11.1
Python Path:	
Server time:	Wed, 03 Jan 2024 19:37:37 +0000

#I reverse like it was ‘DIRS’: and give the originale name back to my HML files.
it’s the same behavior.


<a href="{% url 'learning_logs:index' %}">learning_logs</a> -
<a href="{% url 'learning_logs:topics'  %}">topics</a>"           }

hum I see the same error has before I delete the }


<a href="{% url 'learning_logs:index' %}">learning_logs</a> -
<a href="{% url 'learning_logs:topics'  %}">topics</a>"           


{% extends "learning_logs/base.html" %}

{% block content %}
<p>learning_logs helps you keep track of your learning, for topic you 're learning about. </p>
{% endblock content %}


{% extends "learning_logs/base.html" %}

{% block content %}

    {% for topic in topics %}
     <li>{{ topic }}</li>
         {% empty %} 
     <li> No topics have been added yet.</li>
     {% endfor %}  
{% endblock content %}

I’m kind of lost here.

What specifically is the problem that you’re trying to resolve? Everything I’m seeing makes sense with what you’ve posted, to the degree I’m able to determine.

Blockquote I have not the information’s showed in the browser

Please do not repost your earlier response. I’m asking you for a specific description of what you are seeing that you are not expecting to see (or what you’re expecting to see that isn’t there.) Please do not just post code or templates. Identify the issue to be resolved.

ok now it’s your reply window who open , it was not the case just before.
with the C:\learning_log>python runserver running
when from my browser (google chrome) when I call the link (
I will to see the results display on the browser screen .
the only that I get is

learning_logs - topics"
not in this form but like this

sorry but I get problem with thr reply windows

Ok, so if I understand you correctly, you’re expecting to see a list of topics, but all you’re seeing is the header.

If so:

Is this the complete base.html file?

ok I understant ,I have to compleet this HTML file correct?

I’m asking you if what you’ve posted here is the entire file, or if there is more in that file that you did not include in your post.

I was busy with the

I have on github all the programme on ealalin (ealalin) / Repositories · GitHub (learning_log) it’s open to public view

Or do you prefer to have the file in this post ?

Ok, so that is the complete file.

You have in your topics.html:

This means that topics.html is going to define blocks that will replace the corresponding blocks in the base template - your base.html file.

However, your base.html file does not define a block named content into which topics.html will place the content being rendered. You need to define a {% block content %} and {% endblock content %} in your base template.

Ken thankx very much for your amaziing support , amazing because your are all the time available .

Best regards