I am new to python web frameworks. I am using web.py because I like how raw it is. I am wondering though, how one can produce pages and scripts efficiently when being restricted to sending output through the return keyword? It seems like for any python module you can only send one thing to the browser, even if it is a large string. What am I missing about the python way of server-side scripting? If it helps, I am coming from a PHP perspective. I am used to being able to say print "foo" and foo will appear. Now I am only allowed to print once per module. If you could point me in the direciton of a python approach to scripting vs the php approach I'd much appreciate it! I'm awful confused at this point how python can be so efficient while being so limited.
For example, here is a basic program I wrote:
import web urls = ('/','index') class index: def GET(self): return "foo" ///Where this is the only place on the file I can output anything (and the rest of the file you should be familiar with)
The point is that it appears to me that the only place you could output anything is in the one return line? Now I understand that if the URI arguments change, you can map to a different class and thus output something differently, but even then this seems limited?
Or ultimately, is the point of the web framework to use 'templates' as they are called in web.py? Thanks for the help.