Re: [Tutor] mod_python and other web frameworks
There seems to be a discussion about this sort of thing every other week or so, and I'm always surprised that no one mentions Cheetah Templates (www.cheetahtemplate.org). It's useful for both web and non-Web applications, and has a straightforward syntax that pretty much *is* Python. For web programming, it can be used for straight up CGI, or in a mod_python type setup. I have used it several times and really enjoyed it. There's alot of work being done right now in preparation for a 2.0 release, so the web site should be very up to date, as well as the tutorial / user's guide. Check it out! Bill On 1/25/06, Ben Vinger [EMAIL PROTECTED] wrote: --- Intercodes [EMAIL PROTECTED] wrote: List: I am still open to suggestions. Being also keen to write better web apps in Python, I've spent a considerable amount of time reading about this (and it is indeed confusing), I've opted to try out something like Pylons or Turbogears. One thing I will say though, is that most of the frameworks you've read about can be run on top of mod_python. So mod_python is not one of the lot - it is essential on Apache unless you opt to use CGI or FCGI. But as I understand it, you would always opt for mod_python over CGI or FCGI on a high-traffic website, though CGI or FCGI is of course fine for smaller things. But mod_python is not so easy to work with and it will only work on Apache. So it seems best to choose something else and run that through mod_python when you're on Apache. ___ Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] mod_python and other web frameworks
Some others have already mentioned TurboGears, but since it sounds like you want more control perhaps, I would recommend going with CherryPy (http://www.cherrypy.org). You basically write python code and then expose it to the web (or intranet or whatever). # simple example import cherrypy import time class MySection(object): @cherrypy.expose def index(self): yield h1Hello, world!/h1 yield a href='time'Check the time/a # if you are using Python 2.3, you do the following to expose a method # index.exposed = True @cherrypy.expose def time(self): return pThe current time is %s/p % self.get_time() # this method is not exposed and thus not accessible from the web def get_time(self): return time.ctime() # mount the class at the server root cherrypy.root = MySection() cherrypy.server.start() # end of example You can then run that script and visit http://localhost:8080/. That will call the index method of the MySection object mounted at the server root. You can also visit http://localhost:8080/time. However, http://localhost:8080/get_time is _not_ available to the web, because it is not exposed. Anyhow, CherryPy is very pythonic and flexible. Use whatever DB you want (or flat files or ...). Use whatever templating language you want (or just return html from your methods. Anyhow, that's probably more info than you wanted. Good luck! Christian http://www.dowski.com ps And as a beginner, I would _not_ start with something like mod_python ;-) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Intercodes Sent: Wednesday, January 25, 2006 12:59 PM To: tutor@python.org Subject: [Tutor] mod_python and other web frameworks Hello everyone, Disclaimer: Beginner. I have an idea of coding a web application and decided to do it entirely with python (reddit style). I started looking for web programming in python and somehow I saw mod_python first. Iam perusing the help document now. Few minutes of browsing confused my mind entirely , since it seems there are about 20 different web frameworks available for python. I am left clueless as to pick which one. I have an soft side towards the one I picked first. Considering yourself as a beginner to python ,do you prefer mod_python over all other framework?. Say if you want to create a blog , will mod_python suffice? And is mod_python and cgi (the python lib) different? -- Intercodes ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] mod_python and other web frameworks
Christian,You are certainly right. I couldn't get anything apart from Hello world coding in mod_python. The mod_python manual is also bit vague, not for beginners. I wonder why there aren't any good tutorials on mod_python. I am having a look at quixote as a developer in this list suggested. I would take a look at cherrypy if quixote is too deep for me.Thanks for your time and the example. I believe your website is written completely in cherrypy. Working on so many projects ,nice work. Intercodes# simple exampleimport cherrypyimport time class MySection(object):@cherrypy.exposedef index(self):yield h1Hello, world!/h1yield a href=''Check the time/a# if you are using Python 2.3, you do the following to expose a method# index.exposed = True@cherrypy.exposedef time(self):return pThe current time is %s/p % self.get_time() # this method is not exposed and thus not accessible from the webdef get_time(self):return time.ctime()# mount the class at the server rootcherrypy.root = MySection()cherrypy.server.start ()# end of exampleYou can then run that script and visit http://localhost:8080/.Thatwill call the index method of the MySection object mounted at theserver root.You can also visit http://localhost:8080/time.However,http://localhost:8080/get_time is _not_ available to the web, because itis not exposed. Anyhow, CherryPy is very pythonic and flexible.Use whatever DB youwant (or flat files or ...).Use whatever templating language you want(or just return html from your methods.Anyhow, that's probably more info than you wanted.Good luck! Christianhttp://www.dowski.comps And as a beginner, I would _not_ start with something likemod_python ;-) ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] mod_python and other web frameworks
Hi, I recommend checking out the Turbogears 20 minute Wiki tutorial, although I'd hold off using it until the 0.9 release comes out with some useful changes. When you use it, it sits behind mod_python and responds to requests made. You can see a Turbogears error message here - :D http://digitalsouth.net.nz/~cyresse/index.htm that I've been playing with. Normally it works. ;) Django is also worth having a look at, but it's a bit sharper to learn The Turbogears Google group is really supportive, by the way. Regards, Liam Clarke On 1/26/06, Intercodes [EMAIL PROTECTED] wrote: Hello everyone, Disclaimer: Beginner. I have an idea of coding a web application and decided to do it entirely with python (reddit style). I started looking for web programming in python and somehow I saw mod_python first. Iam perusing the help document now. Few minutes of browsing confused my mind entirely , since it seems there are about 20 different web frameworks available for python. I am left clueless as to pick which one. I have an soft side towards the one I picked first. Considering yourself as a beginner to python ,do you prefer mod_python over all other framework?. Say if you want to create a blog , will mod_python suffice? And is mod_python and cgi (the python lib) different? -- Intercodes ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] mod_python and other web frameworks
Lolo,Thanks for the boost up. I am looking at PSP now and it seems promising. 3 days is impossible for me :) ...maybe a week or more. I will certainly have a look at 'mighty' once I am familiar with mod_python. List: I am still open to suggestions.Thank You.Intercodes--On 1/26/06, Lolo [EMAIL PROTECTED] wrote:Hi guys,I'm using PSP module from mod_python for professional stuff.It's quick and easy to use, so it will be easy tocreate your blog in 3 or 4 days.You can put directly your python code in an html webpage.But currently i take a look at migthy( http://www.myghty.org/index.myt), it's a very cooltemplating framework. And you can use it withmod_python.Have a nice day ...-- Intercodes ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] mod_python and other web frameworks
On 1/26/06, Intercodes [EMAIL PROTECTED] wrote: Liam, I checked the wiki video sometime back. If my memory wont fail me, the guy there never used a single line of python code ;) (I may be wrong) It seemed a totally new language that he used to create that wiki. Iam more inclined to code a lot rather than deal with such high abstraction, as I would like to improve my programming skills and get good python knowledge. I think ill give these two a try once I have some website running under something that uses more python code. I'd say you're referring to the Kid templating. html head title${title}/title etc. As the main handlers uses Cherrypy, which is very much Pythonic, and the object-relational mapper uses SQLObject which is also very Pythonic. For your reference if needed http://www.turbogears.org/docs/wiki20/ Anyhoo, your choice in the end, good luck with the deep end approach. Regards, Liam Clarke ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] mod_python and other web frameworks
Liam,I checked the wiki video sometime back. If my memory wont fail me, the guy there never used a single line of python code ;) (I may be wrong) It seemed a totally new language that he used to create that wiki. Iam more inclined to code a lot rather than deal with such high abstraction, as I would like to improve my programming skills and get good python knowledge. I think ill give these two a try once I have some website running under something that uses more python code. Thanks for your time.Thank You,IntercodesOn 1/26/06, Liam Clarke [EMAIL PROTECTED] wrote:Hi,I recommend checking out the Turbogears 20 minute Wiki tutorial, although I'd hold off using it until the 0.9 release comes out withsome useful changes.When you use it, it sits behind mod_python and responds to requests made.You can see a Turbogears error message here - :D http://digitalsouth.net.nz/~cyresse/index.htm that I've been playingwith. Normally it works. ;)Django is also worth having a look at, but it's a bit sharper to learn The Turbogears Google group is really supportive, by the way.-- Intercodes ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] mod_python and other web frameworks
On Thu, Jan 26, 2006 at 02:07:43AM +0530, Intercodes wrote: Lolo, Thanks for the boost up. I am looking at PSP now and it seems promising. 3 days is impossible for me :) ...maybe a week or more. I will certainly have a look at 'mighty' once I am familiar with mod_python. List: I am still open to suggestions. If you're looking to do some Python coding to put your site together, you might take a gander at Quixote (http://www.mems-exchange.org/software/quixote/). From what I've seen, it's the closest thing to coding a web site in Python. It works best with SCGI, but also with regular CGI and mod_python. gsf ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] mod_python and other web frameworks
Thanks for the input guys. I think ill go with Quixotemod_pythonpostgresXHTMLIll let you know if I have done something useful with the above four :DTYIntercodes If you're looking to do some Python coding to put your site together,you might take a gander at Quixote(http://www.mems-exchange.org/software/quixote/ ). From what I'veseen, it's the closest thing to coding a web site in Python. It worksbest with SCGI, but also with regular CGI and mod_python. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] mod_python and other web frameworks
--- Intercodes [EMAIL PROTECTED] wrote: List: I am still open to suggestions. Being also keen to write better web apps in Python, I've spent a considerable amount of time reading about this (and it is indeed confusing), I've opted to try out something like Pylons or Turbogears. One thing I will say though, is that most of the frameworks you've read about can be run on top of mod_python. So mod_python is not one of the lot - it is essential on Apache unless you opt to use CGI or FCGI. But as I understand it, you would always opt for mod_python over CGI or FCGI on a high-traffic website, though CGI or FCGI is of course fine for smaller things. But mod_python is not so easy to work with and it will only work on Apache. So it seems best to choose something else and run that through mod_python when you're on Apache. ___ Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor