

Zed's "One Battery Review" of Django - jacoblyles
http://www.zedshaw.com/blog/2009-03-20.html

======
tdavis
As a huge fan of Django, Python, and both communities I would like to point
out a few more things:

\- Always track the trunk, there's really no compelling reason not to. It's
always extremely stable and full of new features you won't find in the tarball
release.

\- The ORM is good for simple things, but you may find yourself needing to
write SQL if you're doing anything complicated. In reality this probably
applies to any ORM, though. Even though people ignore it.

\- Caching is built-in, effortless, and awesome.

\- The template language is intentionally crippled in various ways to keep you
from "doing too much" in them. Thankfully Django is modular enough to allow
you to drop in a more powerful replacement if that's your thing.

\- Django is basically retarded when it comes to multi-processing environments
and should not be considered even remotely thread-safe. I mean it. Copious use
of locks can _usually_ keep transactions from walking all over each other, but
your mileage may vary.

\- If you want some piece of functionality or add-on or whatever, chances are
somebody has already written it. Check djangoplugables.com and
djangosnippets.org before wasting precious cycles.

~~~
smharris65
Good point about ORM for any framework. Eventually you'll have to write SQL,
so why use the ORM in the first place?

------
bluefish
I didn't find Zed's review much of a review at all. He doesn't go into a lot
of what's going on under the hood which would really take more than one
battery but is typically more Zed's style.

What Zed does talk about are the conceptual things that make Django appear
good on paper like reusable applications and he also likes Django's tip of the
hat to Jazz. It's too bad he doesn't talk about stuff like the crazy ORM that
Django has which seems to be the least Pythonic ORM out there, or whether or
not Django handles string encodings well, caching, etc. That's the kind of
detail I've enjoyed from Zed's previous reviews... err... rants. Hopefully
we'll see some more substantial review in the future.

~~~
vidar
He actually makes it quite clear that this is a superficial overview.

------
marksutherland
Damn. The day after I claim he's been doing nothing for the past year, he goes
and posts a fairly interesting review of django.

Now, lets quote Zed:

"Read it, and take it as a chance to discuss pseudo-macho speech online, and
whether you really are only listening to perceived strength rather than
reason."

I did some searching, and the highest ranked similar post I could find is this
one which currently has 31 points:

<http://news.ycombinator.com/item?id=404309>

Want to bet this article gets more points? :)

~~~
marksutherland
39 points within an hour or so. I'm not really sure what to take from this
tbh.

------
randrews
I really like the idea of measuring writing in laptop batteries. Start
writing, unplug the laptop, when it's about to die, wrap things up.

~~~
Jebdm
My laptop battery only lasts about 25 seconds. Microblogging it is!

------
kirubakaran
emacs is actually awesome for Python programming. For easy Python coding, just
add the following to your .emacs file:

    
    
      (setq-default tab-width 4)
      (setq-default indent-tabs-mode nil)
    

Also get ipython.el -- very handy. My .emacs is here for your reference:
<http://github.com/ki/my-dot-emacs/blob/master/dot-emacs.txt>

~~~
wyclif
Anybody have a good .vimrc file for Python, or thoughts on customizing vim for
Python?

~~~
bobbyi
Use the indentation script pointed to and explained by this article:
[http://henry.precheur.org/2008/4/18/Indenting_Python_with_VI...](http://henry.precheur.org/2008/4/18/Indenting_Python_with_VIM.html)

It is better than the default vim python autoindentation behavior.

------
mseebach
No. 1 thing about Django that annoys me(1) is that the Admin-interface, in all
it's awesomeness isn't modular and pluggable. I want to put CRUD+filtering
lists on the non-admin part of the site, and can't seems to find a non-hacky
way of doing it.

(1) The list thins out a lot after than. I agree with Zed that the apps-in-a-
site structure is very cool.

~~~
shimon
Do you know about generic views?
<http://docs.djangoproject.com/en/dev/ref/generic-views/>

...and ModelForms?
[http://docs.djangoproject.com/en/dev/topics/forms/modelforms...](http://docs.djangoproject.com/en/dev/topics/forms/modelforms/)

In my experience, "simple CRUD" often gets complicated by permissions or other
special cases, but generic views and modelforms are useful tools for hammering
out a lot of the basics very very fast. Both of them allow for some degree of
customization, but should be helpful in achieving what you want.

------
jasonkester
That was pretty much my first impression of Django as well, and I bet it's the
impression they want to leave.

The reality doesn't really hit home for a few weeks. Django gives you all
sorts of really cool stuff right out of the box that does nearly everything
for you. The problem comes when you want to do something just that little bit
different, and you find yourself unrolling every single piece of it one-by-one
as you discover that these pieces don't fit your needs exactly.

I also found myself baffled by the terrible decision to make everything
revolve around function calls rather than a Request and Response object. No
matter what happens in your page flow, you still need to return a HttpRequest
object at the end of the day. No more Response.Write();Response.End(); from
any point. You need to have every bit of code capable of returning in a way
that triggers the thing above it to return in a way to trigger the thing above
it to return a HttpRequest object. Makes debugging a serious pain.

So yeah, if you're doing a simple CMS for a media site (which is what they
wrote Django to do), it rocks the house. If you're trying to do any heavy
lifting, it seems to fall apart pretty fast.

I don't think I'd use it again.

~~~
njharman
> No matter what happens in your page flow, you still need to return a
> HttpRequest object at the end of the day.

I think you mean HttpResponse object. We must use Django differently (Do you
use templates and contexts?) I don't understand what you are saying in your
bafflement paragraph. And your evaluation of good for simple but not for heavy
lifting is the exact opposite of mine. I love Django cause it makes the
simple, simple and and the hard, possible.

Each view function takes a Request + parameters and returns a Response.
Simple, consistent, and flexible. Easy to write decorators. Easy to reuse view
functions, easy to compose view functions from parts. Easy to ditch the whole
thing and roll your own.

Django is extremely well decoupled. It comes with all sorts of batteries
included but it's very easy to take out a battery and use your own. Templates,
storage, url routing are all easily replaced. Apps can come and go, middleware
can come and go. And most the functionality
admin/auth/caching/templates/storage backend/sessions/etc are split out into
apps and/or middleware so it's easy to replace/extend if you need to do
something special. Recent releases have made even made the admin much easier
to customize without wholesale replacement.

I've even used Django for non web apps. I didn't have to do anything
particularly special. It just worked.

P.S. If you think "media"/newspaper sites are simple, you don't know newspaper
sites.

------
dpnewman
very good overview. i have been learning and utilizing django in most recent
project and generally liking it as well. the things i like the most are the
orm, and the modular application architecture is truly potent. missing however
- and some would have the opposite feeling - the greater opinionation of rails
... i for one welcome a crystallized project structure. my rails projects
still read so elegant, clean, and paired down comparatively.

------
alrex021
> At this point, the only warning I’ve received is that deployment is hard,
> but then, deployment is hard with every web application once you start
> getting serious.

I have 5 django sites running at the moment and can't say that there are any
deployment issues I came across. And its only getting better now that we gonna
probably see "multi-database" support I'm guessing in ver 1.2

------
walesmd
We recently switched to Python at work (and personally, I have a few projects
at home as well).

We opted to go with the web2py framework at work but I have been giving Django
a long, hard look for some of my personal work.

~~~
mtrichardson
Be sure to take a look at Werkzeug ( <http://werkzeug.pocoo.org/> ) - we've
had great success with a Werkzeug, jinja2 and SQLAlchemy setup.

------
charlesju
Is there a Rails equivalent to "The Admin"?

~~~
jon_dahl
Not really. There have been several attempts since 2005 to create Super Auto-
Scaffolding (streamlined, ActiveScaffold, and several other generic names that
I don't remember, like "Ajax Scaffolding"). These aren't identical to Django's
admin, but they could serve a similar purpose.

For all of its innovation, I'm a little surprised that the Rails community
hasn't put together a quality solution for this problem yet. I assume the ORM
differences are a part of this - Django's ORM (I think?) defines the schema in
the application, while ActiveRecord gets this from the database directly. But
does that really make a Django-style admin impossible with ActiveRecord?

------
tjic
Zed writes:

> Now, I know that when I drop the f-bombs and do crazy shit like disagree
> with people they get their panties in a bunch and call it trolling

Actually, no, folks DON'T tend to take simple disagreement as trolling.

However, it's crucial to Zed's self image as an "outlaw rock-and-roll biker"
that his opinions not be accepted, and that he be a renegade, so he has to
remind us each and every time he posts "hey, look at me - I've got an opinion.
Isn't that just so DARING of me?"

Yawn.

~~~
unalone
You actually missed the point entirely, where Zed's saying that he _doesn't_
want to piss people off but that he still thinks "fucking" is a necessary
descriptor to announce his emotions.

