PPL30 Day 16: Django

Evidently today I’m enjoying the magical world of pink freakin’ ponies with wings, also known as Django. It’s a web framework not-too-unlike Rails written in Python. You’ve heard of it. Have you seen this though?:

pony powered

Dorks.

This is part of the Peer Pressure Learning 30 series. To learn more about what in the hell that means, see the intro to the series, A Good Time To Learn.

Installation

Ugh. Follow these instructions from the official Django docs. Homebrew has spoiled me rotten.

Resources

Django Docs Tutorial

I simply followed the tutorial from the Django docs. What better place to start? Honestly, though, it’s a pretty good tutorial, and any time you feel the need to delve deeper into Django’s den, links are peppered generously throughout each part of the tutorial. You’ll not be left wanting.

What I Think I Now Know

I knew I wasn’t going to be able to avoid making audible noises of mild surprise, consternation, or sometimes pleasure throughout this particular topic review. Everything I see I immediately compare to Rails, of course. I hope you don’t think less of me for it. It’s very difficult, and I’d argue counterproductive, to try to learn Django without comparing it critically to what I know. I will, however, keep some ill-formed opinions between myself and my dog.

tempe in action

“Hmm. Pssh. Aaah. Hmmpph. Oooh. Wait, really?”

Let’s focus on the ‘Aaahs’ and ‘Ooohs’ and ‘Wait, really?s’

The Aaah: Django has this concept of projects and apps. In Rails, those two things might seem synonymous. In Django, a project could have many apps. For instance, you might have an admin app, a blog app, and a polls app for your company’s site’s project. I like it. It is, more or less, what Rails Engines probably should be, and maybe still could be, except I don’t think it will ever be quite as clear cut as it is in Django. (Do note, however, that I’ll probably never find out what the true positives and negatives of this are. As always, my experience is super-limited.)

The Oooh followed by Wait Really?: What happened? Django’s freakin’ admin app happened. I had heard of the admin app previously. I swear everyone who ever sees a need for making the ‘Django is better than Rails’ argument leads off with the admin app. (In other news, people on the Internet love to argue.) Nonetheless, there was a bit of an ‘Oooh, it’s that easy to turn on, huh?’. The ‘Wait, really?’ was when I discovered that it 1) looks decent, 2) works better than it looks, and 3) is fairly easy into which to hook your own models. Suddenly I’m creating polls from within an admin section of a site, and I’ve done very little work.

Listen: I realize this is probably akin to what scaffolding in Rails has been; great for prototyping some stuff really, really fast, but it should be either torn out or heavily modified at some point between it being activated and it hitting a production server. I get it. That’s fine. Nonetheless, this seems pretty damned useful. I’m impressed. That pony’s not so bad.

It even used a pretty decent date/time picking widget. Sometimes, it’s the little things….

Other than that, Django is a web framework. You might be familiar with those. It is more different from Rails than I had expected, actually. Part of the reason it seems significantly different is because it is focused on the idea of apps as foster children of projects, in my opinion. In Rails, the project is the app. In Django, the project is a collection of related and sometimes coupled apps. I definitely recommend setting aside some time to go through the Django tutorial.

Having moved past the admin area, I still can’t help but be impressed. As with everything, Django takes more time than I have tonight to give it a fair shake, but the admin app has won it the promise of another encounter. Sometime in the future, I will once again ride the pink pegasus.

django pony

… Hold on, that’s a horrible way to end this article. Forget that. The point is, I’d like to build something with Django some day. What? I dunno. Any suggestions?


Node Node Node. I’ve been wanting to get a handle on the Node.js hype for a while. Finally, it’s time to do it. I’ve already been told to report back to someone what in the hell all the hype is about. I hope to do exactly that. Tomorrow.