[Answered ]-I want to display 'yyy' in the index.html, but when running the server, the page displays normally but without the 'yyy'

1👍

try this

you need pass dict into template from view.

https://docs.djangoproject.com/en/4.2/ref/templates/api/#django.template.Context

def index(request):
   context = {'a1': 'yyy'}
   return render(request, "index.html", context)

in template

<h1>{{a1}}</h1>

Leave a comment