After a long trip around the Python web developpement tools, it’s time to fix. In a previous post (please read all comments before ..) we have talk for a long time about various web frameworks. Here is my personnal conclusion:
- A web framework has nothing to do with templates. It need to allow to wrap templates easily, but it should’nt deal with them directly. (I have done DTML in a past life.. no thanks:)
- A web framework has nothing to deal w/ the object-store. It should let me store objects as i want (without too much pain)
In the previous post we talk about the different approach: Threads, Mod_Python, Twisted, and Fork (in comments)
I have tested quite a bunch of framework right now, all have some nice feature, and drawback. To conclude my tour and explain my choice, some little points:
I really enjoy Webware, because the API is really easy learn, and work like a charm. But as explain before, I have too much trouble w/ the threads in.. I hope cheetah will cleanup the way it includes Kits.. a long thread on the mailing list.
I don’t like the mod_python Publisher etc etc, I feal too close-to-apache. So i guess the I will choose MP Servlets. Performance are really good, and doesn’t need to maintain a server process on the host. This is good news because i want to host a couple of little websites. The major drawback is that there is no way to maintain (or even limit) a pool of objects between request. (without apache tweak) Another bad point is that debugging is awfull, need to restart all the time ..
But mod_python offer a lot for deployement..
This is the most flamewar subject, I ever seen on the Python community. I used twisted, and yes it’s really fun and powerfull. But I don’t want to mix deferred and threads (for DB .. and others stuffs). If I want to mix differents networks stuffs, twisted is my tool. but as previouly said (comments) I ‘m not really fuent with twisted.web
Hum, this is a fork based server.. I haven’t tested it a lot because it’s really template base, and I want to use Cheetah or ZPT not another-templating-o-matic. And fork, may cause issue if you have some hits (but skunk really seems to work well under heavy load so.. )
So, yes, i haven’t choose one of this. In fact, in the previous post somebody ask me about Quixote, so i decided to test it. And I found an interesting stuff,
Quixote use: scgi (mod_scgi + daemon), old-fashion-cgi or mod_python, medusa or twisted.
So I can:
- use mod_python in production area. (nothing more than apache :)
- use mod_scgi if i want to run the server as a different user. No need to use su-exec or fight w/ ownerships…
- use medusa to develop. And that’s a really good point because i can use pdb to debug,and avoid to restart mod_python again and again.
- use old-fashion-cgi on system that only provides this..
- test Durus + Dulcinea for the fun.
There is some drawbacks of course:
- really small documentation right now (check the Quixote Wiki)
- I don’t really like the way it map the URL namespace to the modules
- come w/ custom templating system, but cheetah has a handler (infos in the wiki)
As Phil said: This is your new toy, until the next.
He’s right. I dream one day, Python web’s framework will be more unified. Quixote is a good example of what power we can achieve if the framework cover a large amount of different approach in a unified way.
SkunkWeb is actually not as bound to its templates as it might seem. I was confused by this too — I think the documentation is very focused on the templates, but if you ignore those parts you might start seeing how it can work without them.
I’ve started looking at mod_python for some more advanced Apache development, but it still scares me for a full application. Generally I think of Apache as a fail-safe application that I don’t have to worry about. I fear (though this may be unfounded) that mod_python could make Apache unstable. I certainly don’t want to restart Apache because my application messed up the Python interpreter, but it seems like that can happen.
I’m ok with you Ian, Apache is quite rock-solid app. I found some issues with Apache2 but fixed right now. Mod_python really seems to be stable, even on really heavy load. But yes, I think we should look what happend when an interpreter ooops, segfault or other.
In the other hand, having to monitor only one app isn’t too much hard, but monitoring a bunch of differents servers can be a bit painfull.
I think you should check out WSGI, the new unified python web standard. If you look closely, I think you’ll find that it addresses all of your concerns.
Except that recent posts on twisted.web mailing list say that Twisted doesn’t feet very well in WSGI.. so no support in a near future (hum not definitive right now but .. )
– Bye Bye
Give CherryPy(2) a try. It’s very light-weight, treats your web applications as, yes, applications, and stays out of the way in regards to templating engines, object stores and the likes.
Twisted isn’t nearly as flamebaity as, say, decorators, or even ternary operators >:)
There is actually a Twisted WSGI implementation already (or as close to one as you can be before PEP 333 is finalized). However, your characterization may be accurate for all intents and purposes: WSGI applications need to be written quite carefully or in a particular way to be runnable in the single-process/single-threaded/persistent mode (one of 8 modes WSGI mandates). Applications written for any of the other 7 configurations likely will not work well when run with twisted.web.
The recent Twisted talk on WSGI is really about WSGI supporting Twisted applications, not the Twisted server. I think everyone is fairly comfortable with the server part, but writing portable asynchronous applications is up in the air, and very possibly won’t be supported by WSGI 1.0.
I posted a comment in here a while ago when you were talking about web stuff. Have a look at this:
It has a few bugs right now, but for the most part it just works, and makes it a piece of cake to write certain types of pages.
I’ve had a good experience CherryPy, Cheetah and SQLObject together. Even though the three products are separate technically, they work surprisingly well together.
Here is a small CherryPy2 + SQLObject + Cheetah example:
Note that using inline templates probably isn’t what you want to be doing in "real" projects, but this is really just an example.
Sorry about that constant pimping, but I’m just way too much in love. :)
This page contains a very quick introduction on what CP2 is and how you develop web applications with it:
Please take a look at http://spyce.sf.net. It is small, powerfull and fast. IMHO the best Webframework for Python.
We developed Python Service Objects (pso) for the following reasons:
We are programmers, so pso has been kept simple and basic. The template system offers no built in tags, you have to build your own or subclasses those contributed, by ourselves or other users. We decided on this spartan approach on the basis that by keeping pso simple and light it would be easier to maintain and keep error free. Who uses pso ? New York Stock Exchange, European PArliament, Ericsson, a very big fixed income intertrading concern, some rather nasty .gov agencys.
I have been using mod_python servlets + ZPT + sqlobject for while now, and would recommend it to everybody
MPS is pretty kool, the only issue for me, is that mod_python debugging is awfull.
Spyce is more than suitable for most applications
Unfortunatly the docs give a bad first Impression
After a Iittle effort I am now re-making some sites using spyce to see how it performs
Not much on my mind today.