O'Reilly logo

Django 1.0 Web Site Development by Ayman Hourieh

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Templates: creating a template for the main page

In the first section of this chapter, we created a very simple view for our application's main page. We had to embed the HTML code of the page into the view's code. This approach has many disadvantages even for a basic view:

  • Good software engineering practices always emphasize the separation between UI and logic, because it enhances reusability. On the other hand, embedding HTML within the Python code clearly violates this rule.
  • Editing HTML embedded within Python requires Python knowledge. But this is impractical for many development teams whose web designers do not know Python.
  • Handling HTML code within the Python code is a tedious and error-prone task. For example, quotation marks in HTML may need ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required