Why use HTML in Django Template - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html) +--- Thread: Why use HTML in Django Template (/thread-23048.html) |
Why use HTML in Django Template - ift38375 - Dec-09-2019 I am confuse in usage of HTML(.html) in Django templates, why we can not use .py (python) in Django templates ? RE: Why use HTML in Django Template - Larz60+ - Dec-09-2019 Every web site is ultimately HTML, the following link explains it well: https://docs.djangoproject.com/en/2.2/topics/templates/ RE: Why use HTML in Django Template - snippsat - Dec-09-2019 If would be cool in browser could read .py ,but that's not the case browsers read html.Template allow us to transfer Python-like code into html. So eg on server. my_list = [1,2,3]Template. <ul> {% for post in my_list %} <li>{{ post }}</li> {% endfor %} </ul>What the browser read and render from this template is real html,as that's what the browser understand. <ul> <li>1</li> <li>2</li> <li>3</li> </ul> |