Home »
Django
Django | Creating and Using Templates
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