6 ms·
Zed's "One Battery Review" of Django
- walesmd 18y agoWe 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 18y agoBe sure to take a look at Werkzeug ( http://werkzeug.pocoo.org/ http://werkzeug.pocoo.org/ ) - we've had great success with a Werkzeug, jinja2 and SQLAlchemy setup.
- tjic 18y agoZed 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 18y agoYou 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.
- icey 18y agoI'm not sure if Zed impregnated a member of your family, or pissed in your coffee or what, but maybe you should wait to comment until you have something of substance to say.
- mseebach 18y agoNo. 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 18y agoDo you know about generic views? http://docs.djangoproject.com/en/dev/ref/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.
- njharman 18y agoThe admin annoys me for same reason. It's too awesome to throw away, but wasn't quite malleable enough. This is changing for the very much better in next release/trunk.
- marksutherland 18y agoDamn. 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 http://news.ycombinator.com/item?id=404309 Want to bet this article gets more points? :)
- marksutherland 18y ago39 points within an hour or so. I'm not really sure what to take from this tbh.
- deleted 18y ago[deleted]
- bluefish 18y agoI 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 18y agoHe actually makes it quite clear that this is a superficial overview.
- dpnewman 18y agovery 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.
- charlesju 18y agoIs there a Rails equivalent to "The Admin"?
- mikeryan 18y agoNot that I've seen (maybe in a plugin?) That being said if you use scaffolds to create your models, some of this functionality will be there (CRUD actions on models). You still would need to add a navigation wrapper around these (pretty easy) and the authentication.
- jon_dahl 18y agoNot 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?
- tdavis 18y agoAs 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 18y agoGood point about ORM for any framework. Eventually you'll have to write SQL, so why use the ORM in the first place?
- jasonkester 18y agoThat 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.
- nonrecursive 18y agoThanks for your comment. Zed's review got me pretty interested in Django, but since I'm not building any CMS's for media sites, I'll just stick with Rails and merb for now. Thanks for saving me some time :)
- bluefish 18y agoI've had a very similar experience, but I have been wanting to see how the more current versions hold up.
- shimon 18y agoI've been hacking Django apps around 50kLOC for a couple of years and have found it generally very well designed. It is true that the best-documented interfaces often don't meet your needs exactly, but I've had a lot of good results reaching into Django a bit. Sometimes this just means using some inconspicuous base classes instead of more "convenient" subclasses. Other times it results in some hacking monkey patches. But on the whole, I've found that it saves me time frequently, and in cases when it won't, it gets out of the way pretty fast. That said, it is still a full-stack framework, and it is definitely targeted at sites that mostly serve dynamic pages. Like all frameworks, it has its archetypal projects, and for Django it's blogs/CMS/online community apps. The further your project is from that archetype, the less useful the framework will be.
- randrews 18y agoI 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 18y agoMy laptop battery only lasts about 25 seconds. Microblogging it is!
- alrex021 18y ago> 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
- kirubakaran 18y agoemacs 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 http://github.com/ki/my-dot-emacs/blob/master/dot-emacs.txt
- twopoint718 18y agoThis was the tutorial shed a lot of light on the issue: http://student.northpark.edu/pemente/emacs_tabs.htm http://student.northpark.edu/pemente/emacs_tabs.htm You get to configure at least three things: how many things emacs enters when you press "tab", what those things are, and if you see a tab in a file how wide it should be.
- wyclif 18y agoAnybody have a good .vimrc file for Python, or thoughts on customizing vim for Python?
- Tekhne 18y agoActually, I think vim comes with pretty good Python support by default. I'm using vim 7.1 and there's, for example, a good python.vim syntax file that came with.
- bobbyi 18y agoUse the indentation script pointed to and explained by this article: http://henry.precheur.org/2008/4/18/Indenting_Python_with_VIM.html http://henry.precheur.org/2008/4/18/Indenting_Python_with_VI... It is better than the default vim python autoindentation behavior.
- Mr_Shark 18y agoYou can find some goodies here: http://blog.sontek.net/2008/05/11/python-with-a-modular-ide-vim/ http://blog.sontek.net/2008/05/11/python-with-a-modular-ide-...