Keith Devens .com |
Saturday, August 30, 2008 | ![]() |
| When your enemy is making a very serious mistake, don't be impolite and disturb him. – Napoleon Bonaparte (allegedly) | ||
|
| ← The sky is falling! | Leaving PHP for Python → |

Simon Willison (http://simon.incutio.com/) wrote:
Keith (http://keithdevens.com/) wrote:
I definitely don't want to go the CGI-that-generates-static-pages route. I'd rather have a few dynamic scripts than thousands of static pages.
I'm going to rewrite my CMS in mod_python + Cheetah, and see if that meets my needs. I'm looking seriously now at Hard Hat Hosting, which I'm almost sure offers mod_python, as well as CSoft.net, which doesn't by default, but they said they can run a custom instance of Apache for me with mod_python installed and do funky firewall magic so it works (how's that for service?).
Harry Fuecks (http://www.phppatterns.com) wrote:
Keith,
I disagree that PHP sucks. All languages have pros and cons - about Python you might say it hasn't reached "critical mass" for developing web apps. Others might dislike things like Pythons multiple inheritance. Java is probably the most sane but see you next Christmas when it's done.
There are quite a few skeletons in the closet for PHP4 (such as http://www.edwardbear.org/optimizations) but that doesn't prevent anyone writing good software with it. What PHP4 has going for it is critical mass (you can find at least 80% of what you need in Open Source libraries plus it's installed everywhere) and it's very easy to use / learn / teach.
Smarty is just one template engine (we counted at least 80 public domain alternatives in PHP here).
To tickle your fancy with WACT again - that calendar top right - what if the template for generating it simply consisted of something like this?
<td class="content-right">
<calendar:month class="calendar">
<calendar:title format="%B %Y" class="month" />
<calendar:selecteddaystyle class="linked-day" />
</calendar:month>
</td>
FYI, documented the initial process of developing this tag for WACT here
End of the month will have something to show...
Remi wrote:
You can also look at http://www.python-hosting.com for your hosting.
They support most python web apps, including mod_python + Cheetah.
Keith (http://keithdevens.com/) wrote:
Yeah, I've considered Python Hosting, but I don't think they have PHP available, and I'd still like the ability to use PHP when I want to.
Sparticus (http://www.iamsparticus.co.uk) wrote:
I love php, because I can't code to save my life. Php however, I can do. Which probably says something about php.
Remi wrote:
Actually, they do have PHP available ...
Check out this page: http://www.python-hosting.com/otherAccount
If you take a python account, they let you run PHP at no extra charge.
Jon Perez wrote:
PHP felt like the greatest thing since sliced bread after I moved to it from Perl.
But after trying out Python, PHP was clearly the inferior language. Tolerable to some extent, but definitely more painful to use.
The people who say PHP sucks most probably have tried PHP after they have used Python.
Feel free to post a comment below. Please see my comment policy.
Formatting Rules (No HTML):
Generated in about 0.152s.
(Used 8 db queries)

You already know that Python is a much nicer language to work with than PHP. mod_python hosting is rare, but most hosts that allow CGIs have a version of Python installed somewhere. Of course, the problem with CGI is that it has lousy performance. A trick I've been using recently is to build Python applications which have admin interfaces implemented in CGI that generate static pages for viewing by the general public - in fact I rolled out a new system at work today that does exactly that (for managing photo galleries). Best of all, Python's module system makes it pretty easy to write code for these static CGI apps that can later be ported to a dynamic mod_python solution with (I'm hoping) relative ease.
The downside of this technique is that it doesn't work for pages that need to be served dynamically. Of course, if you wanted to be really interesting you could always use Python to generate static PHP files with dynamic behaviour...