On 06/23/2013 07:44 PM, Νίκος wrote: > Why use mako's approach which requires 2 files(an html template and the > actual python script rendering the data) when i can have simple print > statements inside 1 files(my files.py script) ? > After all its only one html table i wish to display.
Sooner or later your needs grow to the point where your single python CGI file is mixing so much html and python code that it becomes unwieldy. > And if we wanted to to compare an html template method to a web > framework solution? A web framework gives you database abstractions so you can easily target most SQL servers without changing code (MySQL, MS SQL, PostgreSQL, Oracle, etc), and they also provide frameworks for doing authentication and authorization. Authorization in particular becomes unwieldy quickly if you have to do it all in CGI. With a framework it's relatively easy to decorate a view with a wrapper that can only allow the view to be displayed if a web client has logged in with a particular set of permissions (stored in your user database of coures). > What are the benefits of one over the other? If you need to do user logins, a framework is going to become rather essential, in my opinion. At least if you need to support fine-grained permissions, which is what most enterprise web apps require (at least the ones I worked on). > I know you dont use the latter but this questios is for averybody that does. Personally I feel that a templating engine is essential for any web development, CGI or not. Mixing html and code leads to an unmaintainable mess. A framework is not essential, but often desired. If you don't use a framework, eventually you'll find yourself creating your own framework in essence, though often not nearly as robustly or as flexibly. -- http://mail.python.org/mailman/listinfo/python-list