Django

From Jonathan Gardner's Tech Wiki
Jump to: navigation, search

Strikes

  1. Your Django project is not a Python package by default. That means you have to hack sys.path to make things work. Ideally, you should be able to install it like any other Python package.
  2. You have to stick your templates in a random directory.
  3. Django claims to have loose coupling as a goal, but fails miserably.
  4. You have to put site-specific and app-specific configuration in your settings.py config file. This means you can't power two sites from the same codebase.
  5. You have magic in the templates that aren't available directly from regular code. IE, {% url ... %}. (The code version is django.core.urlresolvers.reverse().)


Why I Don't Like Django

I like Python because I don't have to remember much to use it. It's a very compact language with extraordinary capabilities.

Pylons is also a small framework, sometimes called an anti-framework because there really is no framework. (Poke at config/environment.py and you'll see what I mean.)

Django is a framework, a large, bulky one at that. There was no thought given to limiting the number of things a developer needs to know to use it. As such, it has a very long ramp-up time.


Why People Like Django

If you followed the development of the internet back from when Apache was new idea, the evolution from writing HTML to web apps is something like this:

HTML (static files) -> CGI (scripts) -> Mako (templates) -> Pylons (apps)

That's the lifecycle of a web developer joining us today. Except this is what they see:

HTML, Flash (static files) -> ??? (scripts) -> PHP (templates) -> Ruby on Rails (apps)

I think a lot of people skip the entire "scripts" stage, which is why they really struggle with concepts like FastCGI.

Regardless, they are used to complexity. They have no idea that life can be simple. Coming from a time when things really were simpler, simplicity is a virtue that I emphasize.

With the HTML vs. Flash comparison, this impresses in the mind of the young web developer that complexity is the same thing as power. This is simply not the case. HTML is just a terrible, terrible idea for a presentation layer. That's all.

Because they skip the "scripts" stage, they never learn the basics of computer programming as an art and science. They never understand why things like lists and dictionaries and modules are important, and how to share code properly, and all that stuff. They never encounter the concepts of the config file, the database, until much later in their career.

When thy encounter PHP, it seems like a god-send. It's not. It's a trap. Behind the simple concept is a terrible language, a language so horrible I wish no one had to program in it, not even my worst enemies.

Moving to Ruby on Rails is a god-send for PHP refugees. You get a real language (albeit one that is not simple), you get a real framework (again, not simple!) and you can actually do exciting things like program offline actions and such.

When they finally get disgusted with Ruby on Rails, probably because it is too slow for anything but trinket sites, they look into Python, because they heard everything in the Python world is hunky-dory. They latch onto the "largest" project, the one that is similar enough to Ruby on Rails they feel comfortable.

What they are missing is that the idea of frameworks, fundamentally, is flawed. You should never, ever, EVER create walls around the developer. I thought people had learned with Unix, but I guess we are doomed to forever relearn those lessons.

See