share
Stack OverflowPros/Cons of Django vs Pylons
[+300] [14] minty
[2008-09-07 18:57:35]
[ python django pylons web-frameworks ]
[ http://stackoverflow.com/questions/48681/pros-cons-of-django-vs-pylons ] [DELETED]

I'm begining a new webapp in Python. I've narrowed my choices down to Django and Pylons. What are the pros/cons of each?

[+508] [2009-04-24 03:27:36] Ben Bangert [ACCEPTED]

Disclaimer: I created Pylons.

It really depends on the type of application you're building. Both frameworks were originally made to solve different problems. Despite how far they've both come since their creation its still very useful to keep in mind the problems they were created to solve because many of those choices have guided further development.

Django was made for newspaper sites, not just a single newspaper (publishing) site, but for making entire sites quickly. They generally had a staff that needed to start pushing content into the system ASAP, even before the public version of the site might be done. This is still clearly reflected in Django as it has a very complete user-friendly admin interface for the staff to begin entering content.

At the time Django was made, SQLAlchemy wasn't around, and SQLObject was kind of... lacking, so Django has its own ORM. It's still lacking in many ways compared to SQLAlchemy, but it'll work just great for a lot of people's needs.

Django also has the concept of 'apps', which are just directories inside a Django project that do a specific function for the site. This reflects the original creators needs to quickly share components of a site with other sites they made. For example, quickly adding comments, or reviews, to another Django site.

While you can use SQLAlchemy, or other template languages such as Mako, in Django, many of Django's strengths (the existing 'apps' you can re-use, the admin interface, parts of the form library) go up in smoke as soon as you use SQLAlchemy instead of Django's ORM.

Just like the Django authors made Django to scratch their particular itch, I made Pylons to scratch mine.

In my experience, creating sites is a very small portion of their life-span. I actually spend significantly more time maintaining a web application, or adding features to an existing one. So the first thing I wanted in the framework was common places to put the 'basics' of a web application, so that it'd be easier to maintain, and that if other people knew Pylons they'd have an easier time jumping in to help maintain a Pylons app.

For all the sites I've built, they generally involve very different database schemas and data back-ends, with little in common. So sharing 'apps' like Django does just isn't a priority, nor is it feasible given how different each app will actually be (you can't share parts requiring a specific concept of how users are handled if different apps need to handle them differently).

I also needed something small, that wasn't trying to run the show for me. I want to be able to go in and determine how something is going to respond without hoping the framework 'lets' me do it. For this reason, a Pylons app is a bit different from most frameworks, in that the project itself builds the application object, making it easy to get in and tweak and change any core bit as needed.

So the question someone trying to choose should be asking themselves, is what are they trying to build? Because that's really the best way to determine the appropriate framework to use for the task.

Also, at the moment, the Pylons Book is 100% up to date with Pylons, while Django's book has been updated for version 1.1 of Django.


(44) Great reply. Its seldom an alternate framework author post an unbiased view point :) - lud0h
(12) An "alot of people's needs"? hyperboleandahalf.blogspot.com/2010/04/… ;) - keithjgrant
(5) It appears you have thrown out the code and started again with repoze.bfg, so what were you selling here? - polyglot
(5) great post but who cares about the book when all the docs you need are on the web. - Adgezaza
they made django so that they can use it in their job which is publishing news paper. that doesn't mean it's made for newspaper. it's great for anything. & the concept of apps is not mandatory. you can have folders for views & models & do everything in one app. also django has the greatest documentation. - sha256
Disclaimer: I'm a perfectionist with deadlines. Ok, I read this answer...started on the Pylons getting started...managed to find a copy of go-pylons.py....and it refused to run. Back to django for me! I still upvoted the answer, though. - Henry Florence
There is no ultimate tool for solving problems. As Ben said use right tool for the job. Also it is important to accept founded crıtıces. - Denis Besic
1
[+92] [2008-09-07 19:17:09] Jason Baker

How experienced are you in Python? If the answer is "not very", I'd say to start with Django. If you're fairly experienced in python, you may want to look into Pylons. This isn't because Pylons is a lot harder to learn than Django, so much as it is that Pylons's biggest advantage lies in its ease of customization. But to really use that customizability, you've got to know a little bit more about what python software is out there. (This isn't to say that Django isn't customizable, either. It's just that Pylons seems to be more flexible in this respect).

The only other thing that jumps to mind immediately is that Django will automatically generate an administration section on your website for you, which is REALLY helpful.


Not to mention projects like django rest framework, that allow you to plop in a fully functionally rest api with ease or django social auth, which gets you setup to start authing with google, facebook, twitter etc - dubvfan87
2
[+49] [2008-09-07 19:06:09] Espo

Django vs Pylons:

Django vs Pylons [1] by Jordanovski

Pylons vs Django [2] by pyDanny

Django vs. Pylons [3] on CarefulWeb

[1] http://www.scribd.com/doc/24646083/Django-vs-Pylons
[2] http://pydanny.blogspot.com/2007/11/pylons-vs-django.html
[3] http://carefulweb.com/blog/2008/08/11/django-vs-pylons-development-and-deployment

(1) The link to Jordanovski is dead - GUI Junkie
3
[+38] [2009-10-15 16:16:14] joeforker

This was a rant about Pylons, which (for me) consistently ended in frustration. Now the Pylons project has a web framework called Pyramid. Pyramid is the best thing since sliced lists and is what I wound up choosing instead of pre-Pyramid Pylons.

With the old Pylons, I ran up against a wall by the time I had invested enough effort in the project to want security. I consistently ran up against subtle but heartbreaking differences between the documentation and the program's actual behavior.

In Pyramid, authentication and authorization is built-in and the documentation is mind-bogglingly astounding. With those critical amenities provided, the rest of the development process went much more smoothly than my experience with old-Pylons.


4
[+36] [2009-08-27 13:42:35] Anurag Uniyal

I know django but after reading the answers to this question I decided to try pylons for a new project, and my opinion now is

  1. If in hurry use django.
  2. If not in hurry use django.
  3. In special cases where django doesn't suffice use pylons.

Pylons is great but django is simpler integrated approach, this article summarizes it very well http://adam.gomaa.us/blog/2007/dec/16/frameworks-exist-for-conceptual-integrity/


Nice article indeed. I haven't tried Pylons, but it sounds like 'flexible' means 'DIY'. Thanks for the good read. - Sam Simmons
5
[+25] [2008-09-21 11:52:36] Chris

In my experience, when trying to build a very custom web site, I felt too restricted by Django. It seemed to be great for simple tasks, but Pylons gives me the flexibility to build custom things from the ground up. I agree about the learning curve though, as it will take a bit longer to learn the various modules available for use in Pylons than it will to read all the Django docs which are all in 1 place.


(5) +1 Dunno about pylons, but I feel the same way about Django. - hasenj
6
[+20] [2008-09-15 14:33:04] Oin

IMHO, if you want to have a lot of well-written docs for the most common things you might want to build, go for django. Using pylons is actually using the third-party components you can fit together. So you're not going to spend a lot of time on pylons' website, but on the ORM's website and the templating system's website etc.

Also, django now has a PONY [1] And nothing can beat that!

[1] http://www.djangopony.com/

(7) Sorry, but Pylons and TurboGears both had [pony middleware][1] long before Django. TurboGears even had a Web 2.0-ized [pony screencast][2] as an early demo. [1]: svn.pythonpaste.org/Paste/trunk/paste/pony.py [2]: files.turbogears.org/video/BestOfBreed.mov - Matt Good
(7) pylons documentation was the reason I started using it. It continues to do a good job of explaining the magic that is happening so that it is no longer magic to you. That's when you win. - Tom Willis
7
[+13] [2009-04-28 13:44:48] praavDa

I am not an experienced user and never claimed that I am, but for me - Pylons is the framework of choice.

If You have a little experience in python, You will catch the basics in about one, maybe two days. But after that time, You will feel like the one and only ruler of what You created. Everything is custom, You can change almost every elemnt, plus You will learn python and maybe other languages along the way.

We can compare Django and Pylons to Linux distros: for me, Django is like Ubuntu - easy, and works out of the box. On the other hand, I would compare Pylons to Archlinux, where everything depends from You.

As (almost) always in life, more work equals more fun and profit.


8
[+13] [2010-04-20 08:56:52] negus

My first Python framework was Pylons, this was several years ago. I don't know why I didn't select Django - I simply didn't like it after the first look.

But after one year of Pylons experience I had to use Django at my new job and you know... I found it very pleasant, good-documented and neatly structured.

At the moment I may say that all the Rails-related stuff (like WebHelpers and Routes), the needless complexity of Pylons' structure and configuration, the ORMs (sqlalchemy and SQLObject) look ugly compare to corresponding solutions in Django.


this is exactly what i feel about django! - sha256
9
[+8] [2008-09-20 16:34:00] dobrych

Django also has a wide range of reusable apps, which you can use with modifications or as example to create something new. And of course, community matters! Django community much wider, this make big sense for beginners.


That's essentially why I chose Django. I'm new to Python and generally to web frameworks, but not new to web programming. I chose to start with Django due to the broader community, and availability of articles and assistance it brings. - JAL
10
[+7] [2010-02-16 19:13:17] Michael LeValle

The joy of Django... It's easy to get going due to defined conventions and great documentation. When I feel the need, I still have the power to customize (i.e. use a second templating language such as Jinja2 and/or add in support for sqlalchemy). To me, that's the best of both worlds!


11
[+6] [2008-09-08 06:52:41] Mario Fernandez

Pylons is more based on flexibility and having the choice to use different components (like SQLObject or SQLAlchemy for ORM, Mako or Mighty por templates). Apart from this, it uses some things ported from Ruby on Rails, like Routes and WebHelper.

I think Pylons is a good choice if you want to see variety of styles and code, although I it may take you some time to get some speed using it.


12
[+3] [2010-12-14 17:23:38] karthi6624

The next version of Pylons, Pylons 2 seems to be moving towards repoze.bfg, that said and much more you can know from http://docs.pylonshq.com/faq/pyramid.html. This is important if you are considering pylons so that you can focus on the 'would be' inclusions early in your development.


13
[+2] [2009-02-21 04:37:45] LennyB

I am currently looking at Pylons for my work for two reasons.

  1. Pylons has support for multiple databases and Django does not (within reason).
  2. Mako and SQLAlchemy are both available to Pylons and they are both desirable to learn even outside of the web framework world.

(1) Actually, within reason, Django does support multiple databases. PostgreSQL, MySQL, and Oracle. - fuentesjr
(6) Wrong kind of "multiple databases". - habnabit
(2) Django will support multiple databases as of version 1.2 djangoadvent.com/1.2/multiple-database-support - Mark Stahler
(2) They're supported! - Ben Roberts
14