I've been playing around with a few Python based web frameworks for the last few months in order to improve my non .NET based skills. What I like about all of them is that in terms of functionality and programmer friendliness they hold their own, if not surpass, more traditional "enterprise" frameworks.
The three I've spent the most time with are web.py, Pylons, and Django. I wouldn't hesitate to recommend them to anyone, but each has their own strengths and weaknesses.
web.py -- The Good
The calling card for web.py is:
"Think about the ideal way to write a web app. Write the code to make it happen."
and that's a succinct way to describe it. The syntax is very minimal, but expressive. The footprint is the smallest of the three I've used; I wrote the least amount of code out of the three of these frameworks with web.py, and that is a very good thing.
I love the way it handles routing and URL definition. A class represents a view, and GET and POST methods handle those particular http calls. This makes the most sense to me.
The built in template system was a little quirky, but easy enough once I got the hang of it. Installing and running in a development environment was also easy. All things considered, I would have been content using it exclusively, but for a few important issues:
web.py -- The Bad
First and foremost, the documentation is "sparse." Aaron Swartz (the creator and maintainer) is very smart and knowledgeable in Python, but I am not, and often could not figure out a solution to a problem without extensive research.
Installation on a production environment was much more difficult. I have only a basic knowledge of Linux administration, and was only able to get a web.py app running under the slower old CGI based way. Again, the documentation didn't really provide a lot of guidance beyond the basics.
web.py -- The Followup
It looks like some extra documentation has been created for web.py since I last took a look at it, sepcifically with regard to getting it up and running on a server. It does apply to version 0.3, but looks like it warrants another look.
Pylons -- The Good
My next stop on my Python Framework World Tour was Pylons. I found it because at some point reddit switched from web.py to this. I found Pylons to be much more newbie friendly. The documentation ranges from decent to good, and the "getting started" videos were incredibly valuable. Development was just as easy as web.py, though the dev server did not work on my Vista x64 workstation (this may be a Python issue though).
Pylons 0.9.6 uses the Mako template system, which probably was my favorite by a nose. There was a bit of a learning curve to it, but with ample documentation, I didn't have too much trouble.
Debugging Pylons is simple as well. If a page crashes, it presents the stack trace, but goes a step further and lets you execute code at each step in the stack. Just be sure to disable this in production.
The URL routing is great, though a little confusing.
Pylons -- The Bad
While not as sparse as web.py, Pylons' documentation could be better. Too often I found tutorials written for older versions that did not work any more. This next point may be a product of the prior one, but I also found the wiring of the models and controllers to be rather unintuitive and required too much code.
The biggest issue I had again came with deployment. I was unfamiliar with .egg packages and had to stumble around a bit before things were working. I ended up using FastCGI to serve pages, which also required to frustrating moments, but ultimately worked.
Despite these issues, I still maintain a simple photo blog built on top of Pylons.
Django -- The Good
Django is one of the biggest rising stars out there right now. It recently released version 1.0.
What I liked most about Django was the documentation. This is how you are supposed to do it. Thorough, but not overwhelmingly wordy, very quick, and well laid out.
The built in "admin" functionality is also incredibly useful. I wrote my own [crummy] version for the photo blog I mentioned above, but Django's would have been perfect had I known about it. This is an example of one of the many useful features thrown in.
I like the way Models are connected to the Persistance layer as well. You define a class, and the database structures are generated automatically, which makes the most sense to me.
Django does not allow in page debugging like Pylons, but does have a specialized Python shell that let's you perform all of the operations your page would.
Django -- The Bad
Of course, nothing is without fault. The biggest issue I have with Django is the URL routing. Both web.py and Pylons allow you to define a generic view to point to like this:
map.connect(':controller/:action/:id')
While Django basically forces you to be explicit while defining your routes. To me this seems to be too much, though others disagree that the generic way is more "Pythonic."
The template system takes a little time to get used to. It has a very small subset of functionality built in to it, and does not allow for inline python code. Rather, you use what are called filters to do things. You can develop your own filters as well pretty easily.
Memory seems to be an issue as well. My web server does not have a ton of RAM, which didn't seem to be a problem with web.py or Pylons, but when some of my django apps get busy, it quickly runs out of room. This may be developer error on my part though.
In Conclusion
I don't think I can give a recommendation to any one platform, all three in my opinion are strong enough for using in a modern app. web.py is for those who feel adventerous, and know python better than me. Pylons is a good middle ground and has a slightly better template system. Django is the easiest to set up and manage, and has the best documentation when you're stuck.
Be the first to rate this post
- Currently 0/5 Stars.
- 1
- 2
- 3
- 4
- 5