Articles → DJANGO → Render Our View From HTML Template In Django

Render Our View From HTML Template In Django






Steps




  1. Create a HTML template.
  2. Set the template path in settings.py
  3. Change in home function in TestModule.



Create A HTML Template




<html>
   <head></head>
   <body>
      <h1>This is the first heading</h1>
      <h2>This is the second heading</h2>
   </body>
</html>



Set The Template Path In Settings.Py




Picture showing the template path added in settings.py
Click to Enlarge


Change In Home Function In Testmodule.




def home(request):
    return render(request, 'FirstTemplate.html', {})



Output


Picture showing the output of rendering the view from HTML template in django
Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Tuesday, June 11, 2019

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250