Six Python Web Frameworks Compared
snydeq writes "InfoWorld's Rick Grehan provides an in-depth comparison of six Python Web frameworks, including CubicWeb, Django, Pyramid, Web.py, Web2py, and Zope 2. 'No matter what your needs or leanings as a Python developer might be, one of these frameworks promises to be a good fit,' Grehan writes. 'As usual, the choice is highly subjective. You will find zealots for each product, and every zealot is able to present rational reasons why their chosen framework is superior.'"
Really. Best of the lot. Much more direct than those oblique, "All-England Summarise Proust Competition" bits. Leave the PhD at home, and make 'em larf a bit!
"Flyin' in just a sweet place,
Never been known to fail..."
Any python web framework shootout that features neither a flask nor a bottle is not worth drink...err reading!
It's The Golden Rule: "He who has the gold makes the rules."
EVE is built on IronPython. I'd say that's pretty impressive and worth a comparison when talking about web targeted python
Oh really? The subject is "python web frameworks" and you assert that a ruby implementation will score well in this competition? I gotta ask, what version of python does "ruby on rails" support?
What the hell is that? Why was it chosen instead of flak/twisted/tornado/etc?
I'm sorry to see he didn't consider Flask. I've found it to be a beautiful microframework suited for any task one might use Web.py for.
If you are browsing for Python frameworks, you should give it a look.
Just asking.
I dig python. I chose python + sqlite to clean data instead of excel and vba.
1.) It's free (speech/beer)
2.) It's multiplatform
3.) It runs on my freebsd machine as easily as on my mac desktop
4.) I can use a sqlite database exactly like a postgresql or mysql db in the python api (handy).
5.) It added a line to my resume!
etc etc
I hope to never use python as a web designer (because I don't want to be a web dev - no offense). But, I definitely appreciate its generality.
PS: I don't reply to ACs.
Usability, yes. Career, no.
That's like asking whether getting an MBA in your 20s will be more beneficial from both career and competence perspectives than spending 10 years building actual businesses.
Not learning PHP will likely save you from hanging yourself with an Ethernet cable in shame once you discover how thoroughly PHP mutilates you mind.
PHP isn't used much outside of web development. If you have web python skills you can also do other types of Python (command line, daemon) work. if you can get a job, the python one will generally be higher paying because it tends to be used for more technical, engineering, and scientific type applications. But, there are less web python than web php5 jobs.
Surely you are joking?
How much programming do you know now? Because if the answer is "very little" (or none), then you would do well to stay the hell away from PHP for as long as you can. PHP is useful because it's widely available on shared hosting servers, but as a language it is truly terrible. It will confuse you and leave you scratching your head at how to solve a problem at the same time that it's teaching you bad habits.
Just for starters, PHP's library is full of inexplicable inconsistencies. For example, the arguments for mysql_query are "querystring, resource." The arguments for pg_query (for PostgreSQL) are "resource, querystring." Why? Don't ask. This is just one example of the typically slipshod way PHP has been put together. Note, also, that in both cases "resource" is optional. Die-hard PHP programmers will surely chime in at this point, telling you you're much better off using a database abstraction layer anyway, but which one? The PHP documentation lists four, but there are more than that.
Python overall has been designed with much more care and forethought, is a much better language, and doesn't deserve to be put down like lame horses and PHP should be.
That said, if you want to get more Web work, faster, learn PHP.
Breakfast served all day!
twisted isn't a web framework, it's an event driven networking engine
This is a joke. I am joking. Joke joke joke.
PHP is not very good for writing real web applications. It's a real PITA for doing anything sophisticated. The Python + Django combination will allow you to quickly create web apps of various complexities (you can use it to throw together a quick website or use it for large projects).
I'd advise you to go with Python + Django but learn some PHP as well, just so you know what tools you have available to you. PHP has its place, as does Python and Django. Always try and use the best tool for the job :)
Not learning PHP will likely save you from hanging yourself with an Ethernet cable in shame once you discover how thoroughly PHP mutilates you mind.
After writing my master's thesis in PHP I have to take umbrage at your characterization of me and my ilk. Now if you'll excuse me my cats are relaying messages from the aliens and get cranky if I'm not around to interpret.
"Never let your sense of morals prevent you from doing what is right" - Salvor Hardin
The last time I tinkered with Django, I tried writing a simple CRUD app for an existing database at my job. After wasting a few hours learning how the ORM package works and setting up my models, I came to realize that Django does not support database tables with composite primary keys . In other words, it doesn't work with almost any legacy database that you will find in any enterprise shop on the planet. It wasn't worth re-working the schema, so I had to retreat back to Spring MVC and wrestle its XML.
I'll give Django credit, though. It's still several steps ahead of Ruby on Rails, which my last experiment taught me doesn't support more than one database per app !
I make a point to take one these "dynamic language" frameworks for a spin every 6-12 months... because I keep hearing that they are leapfrogging Java, and Oracle is destroying the universe anyway, and my career will be over soon if I don't migrate my skillset. So far I'm just not seeing it, though. These frameworks may be useful for simple non-commerce apps, stood up in a hurry by junior-level devs... but none of them seem remotely ready for any of the realities I deal with day-to-day when working for large companies or handling commerce.
While I'd like to it not be the case, I'd have to agree with you about the general not-quite-there-yet state of dynamic frameworks. That said, Django's custom ORM leaves much to be desired. Next time you decide to give a python framework a try, pick one which uses SQLAlchemy as it's ORM layer. You'll find it to be a much more sophisticated library (similar to Java's Hibernate). In particular, it has all the features you just mentioned. Not integrating SQLAlchemy is one of the main things that keeps me from using Django... any other ORM layer in Python seems doomed to play catch-up.
Career-wise, there are WAY more PHP jobs than Python jobs, so if you're looking to be employed by someone else, PHP first (but don't stop with just one). If you're going to be doing your own projects, Python has evolved in a much more logical way than PHP.
It depends on what kind of web development career you want - there are lots of specialties these days. Learn PHP, and learn all the associated web technologies REALLY WELL (html, css, javascript, ajax, etc). Get really good with an IDE (probably Eclipse). Learn how to use Photoshop and maybe Flash (or Edge). Learn SQL - MySQL especially, but also maybe some NoSQL tools. Learn the backend stuff like memcache, hadoop, etc.
The more stuff you know, the more employable you will be.
Learn how to write well. Being able to express yourself goes a long way in a technical career.
Oh, and learn jQuery after you learn Javascript (not 'instead of').
Not learning PHP will likely save you from hanging yourself with an Ethernet cable in shame once you discover how thoroughly PHP mutilates you mind.
Curse these flimsy UTP ethernet cables! They keep breaking when I put my full weight on them. Where is thickwire when you really need it?
Those who can make you believe absurdities can make you commit atrocities. - Voltaire
Web.py is great for developing web services. Really, really quick and easy to learn. The documentation is probably about a 7 though, I agree with that. However, I'd give it 9s on everything else.
Web.py+mimerender is pretty sweet. Check out the example code here:
http://stackoverflow.com/questions/713847/recommendations-of-python-rest-web-services-framework
I find this infinitely more comprehensible, pythonic, and nice to work with than the other Python web frameworks I've seen. I've never really used Django, but the examples I've seen look pukey to me.
It was probably the best all-in-one python webapp-building mega-framework 5 years ago.
I found Turbogears great because it eliminated (unnecessary) choices (i.e. all mandatory convention),
and pretty much just worked out of the box (modify a working trivial webapp was the way you got started.)
How does its latest version compare to these others? Anyone have an opinion on that?
If TG is no longer competitve, why, and which other one has its good features like I described above?
Where are we going and why are we in a handbasket?
I'm not understanding how that's a bad thing. PHP isn't the only language that has multiple extensions with overlapping functionality. The answer to "which one?" really depends on your needs (which is why there are multiple extensions in the first place). PDO is probably the most commonly used.
They are two completely separate extensions which you should never be using simultaneously. As you've already pointed out, if you can't, or don't want to, use a particular db extension, you should be using an abstraction layer.
What?
I'm inclined to agree with this. PHP isn't a good idea if you're still learning the fundamentals.
http://www.tornadoweb.org/ -- This one looks interesting to me. I would like to try this one. Anyone used it?
Maybe CPUs are so cheap these days that it doesn't matter, but I really like to see speed/performance as a metric when evaluating the technology that runs my website.
Do you really need reason for beer? Wingman Brewers
One thing to keep in mind with modern web development:
Learning the server side language is only a small fraction of the total learning curve.
You will need to eventually learn databases, a smattering of basic sysadmin skills, Javascript, HTML, CSS, a bit of HTTP, and not least the web frameworks or associated libraries and APIs themselves.
With most frameworks sorta looking like MVC (whatever that ends up meaning these days) and the basic problems being the same, part of the learning curve of one system will help with learning another. Most web developers worth their salt will end up knowing multiple frameworks and server side languages anyway.
You should actually try out both Django and something like Symphony2 (PHP) yourself to see which you prefer. Spend a week or so on each running through tutorials and creating demo sites. You'll soon get a feel for whatever you prefer.
Career wise, language popularity isn't necessarily the most important thing really. Niches can still be profitable depending on where you are and supply/demand etc. eg there are plenty of PHP jobs, but standing out from the hordes of barely capable PHP developers can also be difficult for the less experienced.
If you have to just start with one thing though, Django is a good choice. It's the most popular Python framework, and Python is a much better language for learning good coding habits than PHP. And if you later decide you prefer PHP (or the PHP job market), Symphony is still pretty similar from an architectural / functional point of view and having another language behind you gives a better idea of what not to do in PHP. Or if you end up really liking Python, you have lots of other options later for other frameworks if Django ends up being a bit limited or not quite to your taste.
Just stay flexible and open minded, and know that web development will require ongoing learning no matter what.
The only python one I have tried and liked so far is tornado.
Got Code?
And interestingly twisted uses Zope's component architecture. It's pretty cool how the Python frameworks / apps try to play along with each other.
Will learning a Python framework (I am looking at Django) be more beneficial for me from both career and usability perspectives than PHP?
Depends ;)
PHP's usability is clearly inferior (and looks worse, something that actually makes a difference if you look at code a few hours a day).
PHP is used in more in simpler CMS engines (with obvious exceptions like Drupal), so if you are targetting smallish local shops looking for a relatively simple website, then I would advise learning PHP. Python on the other hand is mainly used in more complex environments (see the CMS/web programming framework Plone). A bit more work to get in, but it's also easier to make more money later. Plus it's more fun to program, and you learned a real language that's useful in other contexts.
yeah, lets summarize all of it. for fun.
0. eve runs on stackless python. (server and client. using dx9, not ogl (those bastards!)) .net (web frameworks might also run there, who really knows? or cares?)
1. stackless is cpython without a stack, hence the name. (one core limitation is not stackless' fault)
2. ironpython is python on
3. jython is python on java (at least django runs on that one)
4. these are interpreters. if you dont like it, i have others. also, i have to dock my mackinaw now. ice, ice, baby.
5. ???
6. CALDARI!!!!!!
had to post on eve thread. my clone wanted me to do it.
agreed. i usually started to write pseudocode in python. which is handy. since you can run your pseudocode.
I was disappointed TurboGears wasn't there.
Must be nice to have nothing better to dlo.
These projects sometimes (usually?) have some sort of tutorial showing how to set up a simple website. I know Django and TurboGears do; I'm not sure about the others.
I'd say pick any two of the Three Ps of web programming (Perl, Python, and PHP) and you'd be OK. Don't start with PHP.
Perl and Python combined should give you enough job opportunities and make picking up PHP later a snap, while PHP plus either of the others should keep you from being a bad PHP coder.
As a third one to try to get experience in, Java or asp.net are good choices. Both are annoying in their own ways, but IMO Java's nicer to work in. Don't forget Javascript, too--it's very different from most other languages you're likely to work in, and none of those other languages will give you much of a boost on learning it, the way, say, Perl would for PHP; it draws heavily from non-C-pattern languages, unlike all the others I mentioned, all of which are similar enough that if you know two or three of them the others can be picked up in a couple days (though HR won't see it that way).
You'll be interfacing with databases constantly. Learn proper database design and the kinds of things SQL can do for you (more than you might think!) That's at least as important as any of the stuff above.
Once you know a couple languages, the hard part will be learning new libraries and frameworks, not new languages (within reason--I recently had to try to make sense of some Erlang, and holy fuck...)
If, after that stuff, you want more, try to get really good at configuring Apache and writing .htaccess files to accomplish various tasks. Maybe look at sort-of related tech you might have to work with, like the XML family (XSLT, Schema, etc.)
The answer to "which one?" really depends on your needs (which is why there are multiple extensions in the first place).
I disagree. The reason why there are so many extensions that do more or less the same thing is that nobody in the PHP community can agree on a good way to do something. And this goes double for the core language, which includes features that do the same thing already, except that the features in the core language are so bad that you should skip them and start looking for an extension to do it right. The end result is no two PHP programmers will be doing things the same way, because they each picked a different extension to solve the same problem that PHP failed to solve for them.
What?
You heard me. If you want to get a lot of work programming for the Web, don't learn Python, because Python is relatively uncommon in Web programming, while PHP is near ubiquitous. You will get more Web work knowing PHP than knowing Python. That doesn't change the fact that PHP is an awful, awful language.
Breakfast served all day!
In mysqli_query() the order is ressource, string. Don't use an outdated extension - problem solved.