Learn Django Web Development

What are Django Templates

What are Django Templates?

It is not recommended to write presentation logic(html code) inside python script(views.py) because:

        1.     Views are responsible for controlling purpose

        2.     It reduces readability because of python code + html code

a.     (Business logic + presentation logic)

        3.     There is no separation of roles. Python developer has to involve to prepare business logic and presentation.

        4.     It does not promote re-usability of code.

       

        è To overcome all above problems and to separate presentation logic or html code a separate html file we will create called template.

        è From Python Script(views.py) we can use these templates based on our requirement.

 

Note: -

   è We will create templates at project level. so that all Django applications uses templates.