Django vs Pyramid - My Comparison

04 Jan 2013 0 Comments



A few months back I posted that I wanted to away from PHP for web development and started learning some of the major MVC web development frameworks. The first one I tried was Pyramid, and I wrote about creating a blog engine with Pyramid and MongoDB. This was an awesome experience and I loved using it, so next I wanted to try using Django.

Django's Strengths

You can find many good comparisons on the web. So these are my thoughts after build a blog engine in both systems. Getting started with Django was quicker and easier than with Pyramid because it had everything built in and had much better documentation and tutorials. I loved the kitchen sink manage.py utility vs several Pyramid commands like pserve and pcreate. Also the settings.py was easier and had a better structure than Pyramid's ini files.

One of Django's major advantages was the built in admin page. On my first impression, I loved the admin page and how well the auto-generated pages worked. However, once I started to tweak them I found I was spending as much time working on them as if I created an admin site from scratch. I did find a cool bootstrap theme for the admin pages on github. Overall I like having the auto-generated admin pages for prototyping, but in anything more serious I prefer to make sexier javascript heavier admin pages.

Pyramid Strengths

When working with Pyramid, I found it really easy to switch modules very easy, like when I switched to Jinja from Chameleon or using pymongo instead of an ORM. This is possible in Django but not nearly as easily, in Pyramid it is usually just a simple PIP install and no special configurations are necessary. I also like the syntax for creating views in Pyramid. Pyramid had great use of Python's decorators and easier it made using AJAX easier with its XHR views.

Conclusion

I loved both frameworks and when I am doing a hack-a-thon project or building rapid prototypes then I most likely will use Django. I can get started with a few shell commands and start building. When I have very specific requirements (like mongoDB over sql) or when I want to hand-pick every module myself, then I will probably use Pyramid. In fact I am going to keep the pyramid version of my blog running over the django version, because I feel it is more customized to the various experiments that I will want to take.

What's Next?

Originally, I wanted to spend some time comparing these Python frameworks to Ruby on Rails, but after spending several months with Django and Pyramid and after reading a decent amount of flamewar forums I have decided that I don't need to look at RoR because I have used Python for years, but haven't used Ruby much at all. Python seems to have many different good MVC frameworks without having to learn a new language and framework. I also have been diving deep into node.js and love it as a server-side alternative to python. Tornado/Twisted seems like a cool async framework, a la node, that I will definitely play with soon. Flask and web2py are also on my experiment list and would love your thoughts on those in the comments.

comments powered by Disqus