Django Templates

From Django, we learned that the result should be in HTML, and it should be created in a template, so let's do that.

Create a templates folder inside the "blog" folder, now inside the "template" folder create another folder named "blog"and then create a HTML file named index.html.

Open the HTML file and insert the following:


Hello World!
Welcome to my first Django project!


Modify the views.py file and add the following lines:


from django.shortcuts import render

def index(request):
        return render(request, 'blog/index.html', {})


Now run python3 manage.py runserver and see the result.

Latest Blog