Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror
×
Programming Books Media Book Reviews IT Technology

Practical Django Projects 151

Chromodromic writes "Apress's newest Django offering, Practical Django Projects by James Bennett, weighs in lightly at 224 pages of actual tutorial content, but trust me, they're dense pages. Filled with pragmatic examples which directly address the kinds of development issues you will encounter when first starting out with Django, this book makes an important addition to the aspiring Django developer's reference shelf. In particular, the book's emphasis on demonstrating best practices while building complete projects does an excellent job of accelerating an understanding of Django's most powerful features — in a realistic, pragmatic setting — and which a developer will be able to leverage in very short order." Read below for the rest of Greg's review.
Practical Django Projects
author James Bennett
pages 256
publisher Apress
rating 8/10
reviewer Greg McClure
ISBN 1-59059-996-9
summary A practical introduction to the Pythonic Django web framework.
This book serves an important function by providing progressive, useful examples of Django's role in the development of realistic projects. During the course of the tutorial you build three basic apps: A simple brochureware-oriented CMS, a complete blogging system (with Akismet spam protection and RSS feeds, among other features), and a social code-sharing site similar to that found at djangosnippets.org (with account signups, syntax highlighting via pygments, and bookmarking features — the whole enchilada). You may or may not find these projects immediately relevant to your work or goals, but the projects themselves are really just platforms for delving into Django's nooks and general philosophy. It's an important point to make about the book especially, because though Django itself provides potent facilities for creating reusable code while preserving a high degree of flexibility, "magic" is kept to a minimum compared to some other popular frameworks. It follows that maximizing your knowledge of Django's inner workings through familiar paradigms is critical to making the framework perform to your best advantage. The book excels at accomplishing this goal.

Along these lines, a lot of territory is covered in a short span. You're introduced to a couple of Django's contrib apps — code which comes with a normal Django installation and which cleanly plugs into your own application while remaining extremely customizable. After being ushered through a straightforward installation and database configuration, your first exposure to development is through the contrib app most frequently lauded in the Djangoverse, Django's deservedly well known admin system. But immediately, emphasis is shifted from the basic features of the system to the ways it can be customized. This approach of introducing a feature and then modifying or extending it is repeated immediately with Django's Flatpages contrib app, a very basic CMS which, again, comes with Django and installs with a single line of code and one command.

By the time you've finished the third chapter, you've built the foundation of a typical brochureware site, complete with a working search system and a completely functional customized admin with which you may modify your content using a javascript-based HTML editor (TinyMCE). Pretty impressive for 41 fast-moving pages.

The strongest feature of the book, though, is not the speed or facility with which features are presented, but rather the way these features are always demonstrated with a mind to Django's strongest argument: how easy it is to create reusable code, once you understand the framework's approach. As you move through the next four chapters of building the blogging system, the establish-modify-extend technique of presentation does a good job of working you through various standard Django features — generic views (a very important concept which is illuminated nicely), code organization, ORM techniques, template inheritance, and so forth — and you're smoothly shown the ways by which you will be able to incorporate much of the code you write into your future work. As you begin your last project, the code-sharing app, you've gotten an overview of both coding and workflow techniques which work best with Django. The final chapters reinforce everything you've learned while still introducing new material on library integration, form handling and the newforms library, and code distribution.

The overall approach is very effective, though I found I had to trust the tutorial a little at first in order to get the most out of it. The projects initially seemed somewhat vanilla, so it wasn't until I really focused on the organization of the material that I discovered the book's strengths. Now I wish I'd had this book years ago.

Issues? I had only one, really. The material presents itself as a tutorial suitable for those who are just starting out with Python. For example, near the beginning of the material the def keywork is pointed out as the way Python functions are declared, and similar kinds of notes and comments pepper the tutorial, somewhat unevenly, as well. While I appreciate the impulse to make the material as accessible as possible, I'm skeptical of the book's role as truly introductory at that level, although I could see some experienced developers, especially those coming from other languages, benefiting from these quick notes. But my feeling in general would be that if you're so new to Python that the def keyword is a revelation, you might be better off starting elsewhere before you dive into Django.

This is a minor point, though, and if you're willing to give the material the time, you'll appreciate what Django has to offer more and more with every page. The book maintains a brisk pace which I truly appreciated. And if you've struggled with Django in the past, or you've wanted to learn more about what to do beyond getting the admin running, "Practical Django Projects" is an excellent foundation for your Django education. I absolutely recommend this as the Django book I've found to be, by far, the most useful.

You can purchase Practical Django Projects from amazon.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
This discussion has been archived. No new comments can be posted.

Practical Django Projects

Comments Filter:
  • by JustShootThemAll ( 1284898 ) on Wednesday July 23, 2008 @03:16PM (#24309327)

    Everytime a new framework or web development system gets hyped I can't but wonder why people get so excited about having reinvented the wheel, and a wonky one at that.

    Everything you mentioned in your post has been solved for many, many years already. Just use Perl and the Template Toolkit. Or one of the mature frameworks (Catalyst, Mason) if you hang that way.

    It is fast, stable and mature and gets the job done with little development time. Sure, it isn't the latest hype. But do you care? Should you care? If you want to get things done, use Perl.

  • by VGPowerlord ( 621254 ) on Wednesday July 23, 2008 @03:21PM (#24309401)

    The biggest problem I have with Django is that it was created with newspapers in mind and that sometimes causes problems, particularly in the model.

    For example, the FileField isn't friendly for organizing things by users... the upload directory is fixed in the model, and it only takes strftime arguments if you want dynamic subdirectories... and for whatever reason, there is no move method in the FileField model. I have no use for files sorted by time, as this system is user-driven.

    Which means you need to manually move the file and update the FileField's value in the model, in addition to doing checks to make sure you don't try to move one file over another. (Note: I haven't tried this, I just assume it works, as the FileField is just a varchar(100) / CharField(max_length=100).)

    Oh, and I don't know how Django internally handles <input type="file">, or I'd say to just use a CharField.

  • by LS ( 57954 ) on Wednesday July 23, 2008 @03:26PM (#24309483) Homepage

    Books about programming, especially internet programming, seem a bit archaic at this point. Or at least physical books. I find that especially with open source languages and tools, and even more so those related to the web, there is a wealth of information online, both in serial book format, tutorials, and searchable references. I haven't used a book to learn a language since Learning Perl back in about 2000. I bought a copy but I ended up using a pirated digital copy anyway because it was more useful...

    LS

  • Re:Django Jobs (Score:3, Insightful)

    by Daimaou ( 97573 ) on Wednesday July 23, 2008 @04:56PM (#24310825)

    I'd be happy to telecommute. :)

  • Re:Stupid question (Score:4, Insightful)

    by Teilo ( 91279 ) on Wednesday July 23, 2008 @07:42PM (#24312711) Homepage

    I will add to my above post, that in Django, it is very easy to extend / override almost any part of the framework. Within a week of using it, I was writing my own custom HTML widgets, compound data fields, and even custom added support for custom DB column types. Now, I know that ActiveRecord allows you to do some of these things, but it's not at all easy or intuitive.

    But, hey, if you love Ruby, use Rails.

    The thing everyone has to remember about Django vs. Rails, is that this is really more a Python vs. Ruby debate. The nature of the languages has affected the design of the corresponding framework in dramatic ways.

    That said, I think that, if Rails were done all over again, it could learn a lot from Django.

    Check out Snakes and Rubies [djangoproject.com]. (Google video version [google.com].) It was a pair of presentations on Django and Rails. Good stuff. This was in December of 2005. Yeah, Django's been around for a while, despite the comments about it being a "young" framework.

  • by Anonymous Coward on Wednesday July 23, 2008 @10:01PM (#24313855)
    AFAIK the Romans did the toilet thing more than a few years ago.

If you want to put yourself on the map, publish your own map.

Working...