Home »
Django
Django | Creating and Using Templates
Creating and Using Templates in Django: Here, we are going to learn how to create and use templates in Django Web Development Framework?
Submitted by Pankaj Singh, on October 23, 2018
Templates are html files that are used as user interfaces in Django.
Step 1: Create Sandbox, Activate it, Install Django 1.9, Create Sample Project
Step 2: Select Project Folder i.e. myapp (Outer One) and add new folder with name "templates".
Step 3: This templates folder is root location for all html templates. Add a template i.e. index.html in this folder.
Step 4: Add some html code in index.html template.
Step 5: Add templates location to setting.py in admin app i.e. myapp(inner one)
Step 6: Step 6: Add Controller (i.e. views.py) in Admin App (i.e. myapp[inner one])
Step 7: Add Controller Action Methods in Controller (i.e. views.py)
Step 8: Map routes to action methods in urls.py of admin app(i.e. myapp[inner])
Step 9: Run the Server
Step 10: Open browser and type: http://127.0.0.1:4500