Wired-Tired-Expired: Python Web Development
Anyone who reads Wired magazine and is following the new “the-chosen-one-python-web-framework” saga should find this little bit familiar. Here is my (tongue-in-cheek) take on the current state of Python web dev…
Wired: WWGD
Tired: WSGI
Expired: CGI
In case you missed it, WWGD == ‘What Would Guido Do?’
August 22nd, 2006 at 2:58 pm
What’s going on in the way of a python web framework? To be honest my confusion about how to do web applications in Python is one of my main reasons for not learning more about the language.
I’m used to simply installing mod_php and using silly tags peverywhere. ASP.NET/Mono are even fairly straightforward as long as you don’t mind running them in a separate XSP process from Apache.
But when I hear about Python web development I usually hear about clunky CGI or using something completely unfamiliar like Zope.
Is there a mod_python that executes .py files? Or is it more like ASP.NET/Mono where you run an app server like Zope separately from your web server?
August 22nd, 2006 at 3:25 pm
Yes, there is.
http://www.modpython.org/
August 23rd, 2006 at 5:18 am
Michael wrote:
Is there a mod_python that executes .py files? Or is it more like ASP.NET/Mono where you run an app server like Zope separately from your web server?
Yes.
The point is, you can develop web apps the way you want to. Want php style web pages? Use Python Server Pages (with mod_python or jython!). Want perl-style cgi? Use the cgi module. Want decentralized apps handling each part of your web app? Use pylons or WSGI. Want a big central server? Use Turbogears or Django.
August 23rd, 2006 at 9:14 am
Want to develop your app once, instead of rewriting it three times as your needs grow? Use Rails. *sigh*
August 24th, 2006 at 9:08 am
Hey Michael
There are a number of options. My first foray into Python web apps went through Zope and CGI and I thankfully came out mostly unscathed. CGI is as you said; clunky. And Zope is even unfamiliar to someone who knows Python well (Zope 2 at least - I can’t speak on Zope 3 - it is a different beast).
When I started using CherryPy, that was the first time I felt like I was able to write web applications in Python. I think it is a good place to start with Python web development, and you might never leave
There are a number of good options for doing web dev in Python these days though. There are a few Rails-like full-stack frameworks (TurboGears, Django, Pylons, web.py). There are also lower level libraries like CherryPy and Collubrid. There are also a slew of “templating languages” which can be used with most of the above mentioned frameworks: Cheetah, Kid, Myghty, etc.
One of the big deals in Python web dev is that there are so many frameworks/libraries, it is often hard for a new developer to choose one.
Hopefully this reply was helpful.
Christian
August 25th, 2006 at 7:51 am
Thanks to everyone for their helpful comments! I think I’ll have to try out CherryPy sometime.