Articles → DJANGO → Render Html Using Function-Based View In Django

Render Html Using Function-Based View In Django






Render HTML




from django.http import HttpResponse
from django.shortcuts import render


# Create your views here.

def home(request):
    html = \
        """
    <html>
    <head>
    </head>
    <body>
    <h1>This is the first heading</h1>
    </body>
    </html>
    """
    return HttpResponse(html)




Picture showing how to render html using function-based view in django
Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Sunday, June 9, 2019

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250