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 ...