Slashdot Mirror


Practical Django Projects

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.

151 comments

  1. Django Lessons? by Illbay · · Score: 3, Funny
    --
    Any technology distinguishable from magic is insufficiently advanced.
    1. Re:Django Lessons? by RingDev · · Score: 1

      Glad to know that I wasn't the only one left scratching my head about that one.

      -Rick

      --
      "Most people in the U.S. wouldn't know they live in a tyrannical state if it walked up and grabbed their junk." - MyFirs
  2. Stupid question by SnarfQuest · · Score: 4, Funny

    What's django? Hardware? Software? Language? The fine article doesn't really clue me in.

    Should I imagine a beowulf cluster of these? Praise our new django masters? Profit? Or pour hot grits into my pants?

    --
    Who would win this election: Andrew Weiner vs Andrew Weiner's weiner.
    1. Re:Stupid question by Anonymous Coward · · Score: 0

      Imagine a beowulf cluster of machine-guns in coffins!

    2. Re:Stupid question by StonedRat · · Score: 4, Informative

      A web framework written in Python. And it's better than Rails.

      --
      "Religion is the most malevolent of all mind viruses." - Arthur C. Clarke.
    3. Re:Stupid question by discord5 · · Score: 4, Informative

      What's django?

      I'm sure this'll upset someone, but it's rails for python. Django Project Homepage

      It's pretty neat and in a couple of evenings reading and experimenting you'll have figured most of it out (even if you're new to python).

      I've used it for a few personal projects, but not at work yet so I don't have any experience with it on larger projects. Still, it's pretty neat to get something done quickly.

    4. Re:Stupid question by Kingrames · · Score: 5, Funny

      Boba Fett's dad.

      --
      If you can read this, I forgot to post anonymously.
    5. Re:Stupid question by morgan_greywolf · · Score: 5, Informative
      And why is Django better than Rails? Well, for one it uses Python (obviously). But, in addition, it has:
      • An object-relational mapper so you don't have to write SQL. But you can still use SQL if needed;
      • Automatic admin interfaces. You never need to write another stinkin' admin interface again.
      • It's own template language. Althouh, you can use any other template language you want.
      • Support for memcached caches is built-in.
      • Built in support for i18n and l10n.

      Oh, yeah. And building Django apps is FAST.

    6. Re:Stupid question by keziahw · · Score: 1

      Look it up! From Wikipedia:

      Django is a Romany term meaning "I awake". It is best known as the nickname of Belgian jazz guitarist Jean Baptiste "Django" Reinhardt, whose fame has led to its use throughout music.
      .

    7. Re:Stupid question by Anonymous Coward · · Score: 0

      Imagine a beowulf cluster of stupid questions!

    8. Re:Stupid question by Anonymous Coward · · Score: 5, Funny

      whats rails?

    9. Re:Stupid question by DeathGod321 · · Score: 3, Funny

      That django ate your baby.

    10. Re:Stupid question by Jansingal · · Score: 1

      Better than rails? Why?

    11. Re:Stupid question by Anonymous Coward · · Score: 0

      You forgot that running Django apps is also faster than Rails and PHP.

    12. Re:Stupid question by morgan_greywolf · · Score: 1

      You forgot that running Django apps is also faster than Rails and PHP.

      I didn't forget it -- I just didn't say it explicitly. I said that it's written in Python -- and it works with (but does not require) mod_python. That's all you need to know in terms of performance. I figured that part would be obvious. ;)

    13. Re:Stupid question by Frizzle+Fry · · Score: 1

      Why use mod_python over mod_wsgi?

      --
      I'd rather be lucky than good.
    14. Re:Stupid question by HeavyDevelopment · · Score: 1

      Don't you know DJ Ango?

      He's all the rage on the club circuit

      http://www.youtube.com/watch?v=PLUS00QrYWw

      Pourin' it out for the hommies you all.....

      --
      Badges!?! We don't need no stinking badges!
    15. Re:Stupid question by silverdr · · Score: 1

      Now, could you do us a favour please and out of this list tell us the only point, which Rails doesn't have (yet)?

      --
      Now, mod me down freely. My karma can't get any worse...
    16. Re:Stupid question by HeavyDevelopment · · Score: 1

      Nasal douche on that one. I'm forever going to utter this sentence when someone refers to django.

      Someone please mod this up as funny.

      --
      Badges!?! We don't need no stinking badges!
    17. Re:Stupid question by Teilo · · Score: 1

      Mostly because Django was originally written to use mod_python. It works extremely well, even for high volume sites.

      It will run on on mod_wsgi also.

      Second, there are a few bits that are not fully wsgi compliant, but they are presently being fixed (and will probably be committed in the next few days).

      --
      Mir tut es leid, Menschen daß Einfältigfehlersuchenbaumfolgendenaffen sind.
    18. Re:Stupid question by Teilo · · Score: 1

      Rails has those things.

      Rails also has many problems. There is far too much magic. It's code is a mess. It is slow, and difficult (though not impossible) to scale.

      Django has little or no magic. It's code is extremely clean, organized, and readable, and scales very well. It is also very fast.

      It is not correct to say that Django is Rails for Python (in the same way, say, that CakePHP is for PHP). There are some similar ideas, but they have very different implementations.

      --
      Mir tut es leid, Menschen daß Einfältigfehlersuchenbaumfolgendenaffen sind.
    19. Re:Stupid question by FooBarWidget · · Score: 2, Interesting

      "And it's better than Rails."

      Then where are the Django killer apps? No seriously, where are they? I can't find more than a hand full of Django apps. And when I asked this question on #django and #python, multiple times, nobody - not even a single person - could tell me even one killer app written in Django. If Django is so great then where are the apps?

    20. Re:Stupid question by Teilo · · Score: 3, Insightful

      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. (Google video version.) 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.

      --
      Mir tut es leid, Menschen daß Einfältigfehlersuchenbaumfolgendenaffen sind.
    21. Re:Stupid question by FooBarWidget · · Score: 1

      I don't know how much you know about Ruby on Rails, but it can do all those things you mentioned by default, exception auto admin interface and i18n. For auto admin interface there's ActiveScaffold, and for i18n there are a number of third party plugins.

    22. Re:Stupid question by FooBarWidget · · Score: 1

      I'm writing a Rails application right now. It ran at 0.8 requests/sec in production mode. Then I spent 15 minutes on implementing fragment caching in my app, and my performance jumped to 40 requests/sec. And I'm not even done optimizing yet. Using Phusion Passenger and Ruby Enterprise Edition gives you additional performance boosts and memory reductions.

    23. Re:Stupid question by Just+Some+Guy · · Score: 1

      Without context, those numbers are meaningless. If the pages are huge, many-joined reports with lots of logic, then that's pretty good. If they're generating semi-static pages (like writing "Hello, %!" % username) up in the corner, then that's horrible.

      --
      Dewey, what part of this looks like authorities should be involved?
    24. Re:Stupid question by Anonymous Coward · · Score: 0

      wrong! it's his french uncle.

    25. Re:Stupid question by FooBarWidget · · Score: 1

      The content is generated from text that's formatted in a special language, and the text may or may not include code that needs to be syntax highlighted. The parsing and generation is pretty heavyweight.

    26. Re:Stupid question by crypie · · Score: 1

      Well, take a look here - http://www.djangosites.org/ to see just a few sites developed in Django. Django itself is the killer app. It's a framework.

      I'll shamelessly plug Satchmo - http://www.satchmoproject.com as a successful online ecommerce/shopping cart that compares very favorably to the PHP based ones.

    27. Re:Stupid question by hotfireball · · Score: 1

      What's django? Hardware? Software? Language?

      A movie... http://www.imdb.com/title/tt0060315/

    28. Re:Stupid question by hotfireball · · Score: 1

      An object-relational mapper so you don't have to write SQL.

      You mean that impedance mismatch misuse, when you still write SQL, once you use custom stored procedures?.. ORM is not any Good Thing for advanced use. In Python it still more sweet, but in Java all this Hibernate and TopLink circus is just a nightmare of complexity over stupid triviality. Something very similar to SQLObject and SQLAlchemy, though I agree it is much lighter (due to Python itself)...

      It's own template language. Althouh, you can use any other template language you want.

      Is it really truth? The only template is really good -- ZPT from Zope, that... won't be used with Django. Maybe it was fixed already, honestly I do not know, but this bug is kind of scary and response from Django developers kind of stupid: http://code.djangoproject.com/ticket/1140

    29. Re:Stupid question by smittyoneeach · · Score: 2, Informative

      It's generally fascinating to watch people not grasp the fundamentally different world-view of a relational database with an object-oriented system.
      It's the difference between a warehouse and retail floor, yeah, you can blur things somewhat with a Costco or Sam's Club, but the ideas of how things are managed between a warehouse full of boxed bicycles and a bikeshed full of them is substantially different.
      The joy of watching someone take an .xsd and map it directly to a set of tables, with foreign keys to capture the nesting of complex types,
      then having them say "why does this query with 10 INNER JOINS run so slow?" is truly exquisite.

      --
      Get thee glass eyes, and, like a scurvy politician, seem to see things thou dost not.--King Lear
    30. Re:Stupid question by balbeir · · Score: 3, Funny
      It's django for ruby

      Duh!

    31. Re:Stupid question by silverdr · · Score: 1

      Now - this is completely different than saying "Django is better because it has this, that and that". If "morgan_greywolf" wrote as you did I wouldn't even bother to reply. Regards,

      --
      Now, mod me down freely. My karma can't get any worse...
    32. Re:Stupid question by Teilo · · Score: 1

      I'm calling you on this one. Your premise is silly. Rails has some very visible killer apps, not because Rails is intrinsically better, but because Rails was first with many new, innovative, and tightly integrated ideas that created a large and well-deserved fan base.

      And, guess what? When those developers signed on, there were no killer apps on Rails either.

      There is nothing intrinsic in either Rails or Django that makes either more likely to be the platform for the next "killer app", except for one thing: hype.

      Django is a very successful framework, which is just hitting its growth curve. It also has a more muted philosophy of hype - meaning that most of the time you will never know you are using a Django site, because businesses who use it aren't advertising the fact, and really don't care to.

      Now, I also think that Django is better than Rails. It's better for me. It may not be for you. In that case, stick with Rails. It's a great framework.

      --
      Mir tut es leid, Menschen daß Einfältigfehlersuchenbaumfolgendenaffen sind.
    33. Re:Stupid question by GooberToo · · Score: 1

      A better question, why use Django over TurboGears? Seriously, I'd really like someone to clearly point out the benefits of one over the other. If you can a link of a comprehensive review and/or comparison, I'd love to see it.

    34. Re:Stupid question by FooBarWidget · · Score: 1

      Django was open sourced in 2005 while Rails was open sourced in 2004, and yet Django still isn't at Rails's popularity of 1 year ago.

      "It also has a more muted philosophy of hype"

      Sure, but is that a good thing? Marketing is important. Programmers too often underestimate the value of marketing. If Microsoft never marketed then it wouldn't have 95% market share on the desktop. If Apple never marketed then there would be a lot less OS X/Ipod/Iphone users.

      But more importantly: marketing/hype creates the opportunity for you to convince your boss or client that your choice of framework is justified. I like Ruby on Rails. You like Django. If your boss or client has never heard of RoR/Django then he's going to be reluctant about letting you do the job. After all, if a framework is not well-known then he'll have a hard time finding new and cheap system administrators or developers to maintain the website after you've left. Then you're either forced to use Java 2 Enterprise Edition or forced to seek a new job.

    35. Re:Stupid question by Teilo · · Score: 1

      There is little to nothing you can do to convince clueless executives who can't see beyond J2EE. That is besides the point.

      Also, a 1 year lead on something as new and fresh as RoR is huge, I mean, really friggin' huge. Fact is, it's taken about three years for Rail's hype to die down enough for people to realize that, just maybe it isn't "all that". It is at this point that development decisions become less starry-eyed and more pragmatic.

      So perhaps that explains why Django is on the upswing now. That, and it's used for such excellent sites as:

      Revver
      Dpaste
      curse.com
      SuggestionBox
      Lefora
      Mixin

      — all things that you can show a CEO/CIO to make clear that Django is a player. More are coming rapidly. As for business sites, there are a plethora of them that are beautiful and functional.

      --
      Mir tut es leid, Menschen daß Einfältigfehlersuchenbaumfolgendenaffen sind.
    36. Re:Stupid question by hotfireball · · Score: 1

      Well, recently I ditch all the ORM crap and believe me â" me and our entire team is *very* happy with that. As for Python, knowing how SQLObject is done, I do not even to know it exists on this planet. SQLAlchemy probably is the best choice in Python world, but it is still too far from nearly good that is could be actually labeled as "nice". And I also do Java stuff, so after I get rid of Hibernate horror and Oracle TopLink crap -- to maintain my own convenience wrapper for plain JDBC ~300 codelines is way easier to support and scale as well as tremendously simpler to maintain, rather then 70MB pile of complicated crap that still requires me to write SQL queries, define huge XML mappings and debug the whole thing much more longer than do real programming. Besides, I use Java port of ZPT templates to keep all the SQL queries outside the code and these are very sweet templates! :-)

    37. Re:Stupid question by smittyoneeach · · Score: 1

      I saw one guy whose attitude was "I know PHP, so I'll just SELECT * and do everything in script"
      In fairness, this may work OK for small stuff.

      --
      Get thee glass eyes, and, like a scurvy politician, seem to see things thou dost not.--King Lear
    38. Re:Stupid question by hotfireball · · Score: 1

      You say "Pornographic Hypertext Preprocessor"?.. Select asterisk?.. Oh. :-)

    39. Re:Stupid question by smittyoneeach · · Score: 1

      I thought it was Puking on Hewlett-Packard, but to each their own. ;)

      --
      Get thee glass eyes, and, like a scurvy politician, seem to see things thou dost not.--King Lear
    40. Re:Stupid question by Black+Perl · · Score: 1

      Hmm. I don't think you have proven its better than Rails. All you've proven is that you don't know Rails, so you *want* Django to be better. The truth is, they're more similar than you think. And they are both great frameworks.

      Let me address your comments...

      An object-relational mapper so you don't have to write SQL. But you can still use SQL if needed;

      Exactly like Rails.

      Automatic admin interfaces. You never need to write another stinkin' admin interface again.

      In Rails, you can pick from many plugins that give you very nice ajaxy admin interfaces, or generate a simple one automatically. You don't need to write one if you don't want to.

      It's own template language. Although, you can use any other template language you want.

      Rails has a template language, too. Erb. And you can use other template languages as well via plugins. I prefer Erb, but many like Haml.

      Support for memcached caches is built-in

      This is built into Rails too. Along with support for other types of caches as well.

      Built in support for i18n and l10n.

      You can do this now, though it's not quite as clean as in Python. I was surprised, with a language that started in Japan, that Ruby didn't initially support these things.

      Oh, yeah. Building Rails apps is fast, too.

      --
      bp
    41. Re:Stupid question by Anonymous Coward · · Score: 0

      A web framework written in Python. And it's better than Rails.

      Actually there are quite a few web frameworks that are better than Rails out today... so that's not saying much. Rails is the idea that launched a thousand ships and it's not too strange to think that many of the inspired frameworks would surpass Rails. The problem today is picking which one.

  3. Just for the record: Django is a Phyton framework by dk90406 · · Score: 2, Informative

    I must be getting old. Never heard of this before, so the article was confusion at first. For info: http://en.wikipedia.org/wiki/Django_(web_framework)

  4. Django or Turbogears? by Just+Some+Guy · · Score: 2, Interesting

    I'm getting ready to port a fairly large web app from Zope to either Django or Turbogears (easier development, more scalable for us, etc.). From what I've heard, Django is kind of the Ruby On Rails of the Python world, and while outstanding for writing small mostly-read apps, it's not the greatest for large interactive applications. Conversely, Turbogears seems to have the reputation for a higher initial learning curve and startup cost, but better interactivity.

    Any thoughts on the matter? I've used Django for some small projects and my experience kind of mirrored what I'd read: it's brilliant when you want to work with it, and a complete PITA when you're trying to do something unexpected. I haven't written anything with Turbogears yet so I can't personally compare them.

    No, I'm not going to make my decision solely on the opinions of Slashdot. Consider this the start of my research, not the end. :-)

    --
    Dewey, what part of this looks like authorities should be involved?
    1. Re:Django or Turbogears? by Anonymous Coward · · Score: 2, Interesting

      Why not keep the application in Zope? You'll have the ability to better fine tune the application from Zope if the application is truly large. if the issue is it's written in Zope 2, you might as well fix it for Zope 3. Django/TG more scalable than Zope? No. In fact you've more limitations with Django, but only because of how restrictive the ORM can be in certain situations.

    2. Re:Django or Turbogears? by Just+Some+Guy · · Score: 3, Funny

      My company is moving toward using a unified codebase for our applications. Whether you're viewing an invoice in a desktop app or on the web, it's calling the same function (written in Python, using SQLAlchemy). Every time I've looked at using code in the filesystem from Zope, it's been overly complicated and problematic. Right now we use External Methods to make specific functions available inside Zope, but the side effect of that is that we have to restart the Zope process every time we want to run new code.

      Another problem is that a lot of our pages take a long time to generate - think reports that take a minute or so. Because Zope is so minimally threaded, that means that other page views are delayed until those reports are finished. We use a pool of 8 Zope instances connecting to a Zeo server, with Apache sending queries to random instances to balance the load a bit. It's still too common for a use trying to view the front page to accidentally get queued up behind another using running "Financials 2004" and cursing at a blank screen until that report is done.

      Add those together and you get an environment where most development is done over Webdav and is consequently a lot harder to manage with version control, 8 giant server processes are splitting the load, and changing a line of code can require a complete restart of the whole mess.

      Yeah, we're ready to migrate.

      --
      Dewey, what part of this looks like authorities should be involved?
    3. Re:Django or Turbogears? by VGPowerlord · · Score: 4, Insightful

      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.

      --
      GLaDOS for President 2016! "Well here we are again. It's always such a pleasure." -- GLaDOS, 2011
    4. Re:Django or Turbogears? by Just+Some+Guy · · Score: 1

      That's exactly the kind of stuff that had me wringing my hands. Our site involves a lot of data entry, like allowing customers to enter complex invoice information. I've heard that Turbogears is a lot better about that stuff because it doesn't make as many assumptions on your behalf, which conversely means that you have to make them yourself.

      --
      Dewey, what part of this looks like authorities should be involved?
    5. Re:Django or Turbogears? by dedazo · · Score: 1

      In my experience, Zope is overkill in most situations. And I (personally) have never liked ZODB at all.

      --
      Web2.0: I love when people Flickr my cuil and digg my boingboing until my google is reddit and I start to yahoo
    6. Re:Django or Turbogears? by moep · · Score: 1

      While I agree with you that the "default" FileField implementation is not very well suited for more advanced use cases, I have to strongly disagree that this is actually a problem. Beeing django and not rails you can very easily enhance or even replace every part of the framework without writing everything from scratch. This partly due to the nature of python and partly due to the design of the framework. And I really cannot see why the implementation of the FileField is in anyway newspaper related???

    7. Re:Django or Turbogears? by mweather · · Score: 1

      Why do you need the files in specific directories? Can't the app figure out which file belongs to which user?

    8. Re:Django or Turbogears? by legutierr · · Score: 1

      Why not just run the heavy reports in a separate instance or on a separate machine? That way reporting won't cause standard transactional traffic to be queued up behind it, but without any more than a day of time investment.

      And, if I may add my two cents, might it not be easier to code a wrapper around External Methods that abstracts the complicated elements of loading code from the file system, and that is able to dynamically load new methods from the file system (or check for changes)? And even if you can't do that, it seems a waste to recode an entire system just to avoid restarting a server when code changes are deployed. How often do you deploy into production at a time of day that the system needs to run continuously, without a one-minute interruption?

      Just my two cents, but I would like to know your thought process. I have found this type of question to be difficult to answer in the past.

    9. Re:Django or Turbogears? by Just+Some+Guy · · Score: 1

      Well, by the time I was done with all that, I'd basically be reimplementing a different framework. With Django or Turbogears, I can let Apache spawn off as many child processes as it needs and not worry if a few of them are running slowly.

      Sometimes we make quite a few changes during the day, or more specifically, we'd like to make more changes but can't easily because of the architecture we're up against.

      Here's how I explained it to my boss:

      Zope is an excellent product and it was absolutely the right choice at the time we picked it. We wouldn't have the web application we're enjoying today if Zope didn't exists. However, since then new options have come along that would be a better match for our needs and the way we work, and since the two main options are written in Python (which is our company's standard platform), porting the logic from Zope to a new system should be relatively easy.

      --
      Dewey, what part of this looks like authorities should be involved?
    10. Re:Django or Turbogears? by VGPowerlord · · Score: 1

      And I really cannot see why the implementation of the FileField is in anyway newspaper related???

      Because news stories are usually sorted by date, so it makes sense that files and images (ImageField inherits from FileField) are sorted by date as well.

      --
      GLaDOS for President 2016! "Well here we are again. It's always such a pleasure." -- GLaDOS, 2011
    11. Re:Django or Turbogears? by Daimaou · · Score: 1

      I've used Django, Turbogears, and Zope. I hate Zope, so I wouldn't use it for anything. I liked Turbogears OK, but Django has a more unified feel to it. It seems a lot cleaner and more straight forward to me as well, so I would recommend Django over the other two, but that is just my opinion.

    12. Re:Django or Turbogears? by VGPowerlord · · Score: 1

      It could, but I want to periodically create a compressed archive of all the files each user has. It's much easier if I can just do that using a small program to compress all the files in each directory rather than having to query the database to find all the files for a user.

      --
      GLaDOS for President 2016! "Well here we are again. It's always such a pleasure." -- GLaDOS, 2011
    13. Re:Django or Turbogears? by imbaczek · · Score: 1

      so the users can organize stuff by themselves if they wish?

    14. Re:Django or Turbogears? by Daimaou · · Score: 1

      If you are going to use Django, I would recommend using memcached, of course, and also using a light-weight webserver like Nginx to serve your static content and only use Apache to serve the dynamic Django content. There is no reason to have Apache serve static content when other servers can do it more efficiently.

    15. Re:Django or Turbogears? by Daimaou · · Score: 1

      That was what I was going to say as well. If your model keeps track of who owns what files, who cares where they are?

    16. Re:Django or Turbogears? by Just+Some+Guy · · Score: 1

      Actually, we have precious little static content. There's the odd cacheable JavaScript or CSS file, but that's about it. I wholeheartedly agree with the concept, though. I've worked at places where we used multiple Apache daemons on the same machine, some running mod_perl etc. and the others stripped down for nothing but static content.

      --
      Dewey, what part of this looks like authorities should be involved?
    17. Re:Django or Turbogears? by Anonymous Coward · · Score: 0

      Take a look at pylons and SQLAlchemy. Much of the same ease and power, but even a little more flexibility.

    18. Re:Django or Turbogears? by Anonymous Coward · · Score: 0

      Have a look at Pylons; it's only slightly more trouble than Django to get started, but it's much more flexible. No automatic admin pages, though.

    19. Re:Django or Turbogears? by Wheat · · Score: 1

      Right now we use External Methods to make specific functions available inside Zope, but the side effect of that is that we have to restart the Zope process every time we want to run new code.

      Eww, External Methods. You can refresh an external method without restarting the process - but if you are using external methods then you're most likely using old school style of Zope development. It was cool in the year 2000 - but today one should "run away!" - you'll be much better off with Django or TurboGears.

      Zope hasn't been sitting still for the last 8 years though. Zope 3 style development became stable around 2005, which was dramatically different than Zope 2 development - no code-in-the-database, acquisition or any of the less fortunate choices made in the early days of Zope. But Zope 3 has quite a learning curve and doesn't have the immediate productivity of Django or TurboGears. Grok (http://grok.zope.org) is the newest framework from Zope-land, and it's much more similar in development style to Django and TurboGears. It's what I use so, I recommend it :). Conceptually you'll find it a smidge more complex than Django or TurboGears, but there is a lot of nice stuff in Grok - it's the only Python framework that uses convention-over-configuration and it's buildout-based installer makes it easy to upgrade specific parts of the framework easily for example. Of course, porting an old school Zope 2 app to Grok is no easier than porting to Django or TurboGears - Zope 2 and Grok are really quite different beasts.

      Any thoughts on the matter? I've used Django for some small projects and my experience kind of mirrored what I'd read: it's brilliant when you want to work with it, and a complete PITA when you're trying to do something unexpected. I haven't written anything with Turbogears yet so I can't personally compare them.

      Well, poor Django often gets knocked for "not handling the unexpected". This is because the framework bundles application code with it (the admin app)- but in those cases where the app code doesn't do what you want you can just not use that app code. In which case you are around the same place you'd be with TurboGears. However, TurboGears is already distributing it's framework as individual parts, so you are, at least culturally, one step closer to integrating Python packages that don't ship w/ the framework into your project.

      Because Zope is so minimally threaded, that means that other page views are delayed until those reports are finished.

      FYI, you can configure the number of threads with the "zserver-threads" option in the zope.conf file (the default is 4). But then your most likely better spending your time porting to newer technologies than mucking around with the old stuff.

    20. Re:Django or Turbogears? by Anonymous Coward · · Score: 0

      For example, the FileField isn't friendly for organizing things by users...

      This is changing (most likely) by the time 1.0 comes out in September.

      Marty Alchin has been working on the file storage refactoring which should vastly improve your experience (particularly when combined with the large file upload fixes that were recently added to the trunk)

    21. Re:Django or Turbogears? by ubernostrum · · Score: 1

      For example, the FileField isn't friendly for organizing things by users

      Which will change with the swappable file backends being introduced by ticket #5361, which is scheduled to land for 1.0 beta (and thus to be part of the 1.0 release in September). That ticket's been held up a bit by a related piece of work which landed not too long ago: configurable file-upload handlers.

    22. Re:Django or Turbogears? by Anonymous Coward · · Score: 0

      There is no problem, we use Django for a site with a lot of large file uploads (which had a problem, because it loaded everything in memory, fixed in the trunk), and Django handles those uploads as fine as for example CherryPy (TurboGears).

      Read this part of the documentation for more information about handling the uploads yourself http://www.djangoproject.com/documentation/upload_handling/

    23. Re:Django or Turbogears? by Anonymous Coward · · Score: 0

      You mention the need to restart the Zope process every time you want to run new code.

      Are you referring to reloading Products which contain code changes?
      If so, https://launchpad.net/refreshng

      To be honest, I wouldn't allow a process like Zope to render the reports by itself, I'd pass it off to a daemon running on the server.

      It sounds like to me you've a serious design flaw in your application(s).

    24. Re:Django or Turbogears? by Just+Some+Guy · · Score: 1

      Are you referring to reloading Products which contain code changes?

      Nope. We looked at Products, but they'd require more modification to our cross-application business logic layer than we really wanted to make. Basically, we didn't want to make the code a good fit for Zope specifically at the expense of making it a worse fit for everything else that used it. If Zope had been our only user of that code, sure.

      To be honest, I wouldn't allow a process like Zope to render the reports by itself, I'd pass it off to a daemon running on the server.

      It sounds like to me you've a serious design flaw in your application(s).

      The code works like this:

      • User submits a form to request a report.
      • A Python script validates the request.
      • A Z SQL Method runs a query with the given parameters.
      • The results go to a Page Template for rendering.

      Your solution:

      • User submits a form to request a report.
      • A Python script validates the request.
      • The user is redirected to a temporary page.
      • The parameters are sent to an external daemon.
      • The user keeps auto-refreshing the page every few seconds to see if the report is done yet.
      • Zope eventually finds the report.
      • The results go to a Page Template for rendering.

      Yes, I can see why you would think that my design - which is exactly how The Zope Book tells you to do it - is seriously flawed. :-)

      Or maybe it's partially because Zope by default only supports four threads, and that to get more than 7, you have to "enter quite deep into the systems' bowels".

      But I don't want to slag on Zope! It's a good app server, and was vital in getting our application to the point it's at today. It's just that we've outgrown it, and don't want to invest a huge amount of effort in making our installation yet more customized and complicated to hope we can get a few more years out of it. We're taking this chance to step back and re-evaluate some decisions and start on a slightly different path.

      --
      Dewey, what part of this looks like authorities should be involved?
    25. Re:Django or Turbogears? by VGPowerlord · · Score: 1

      The scary part is, I know the person who filed that ticket... and the person this is assigned to; they're the same person.

      I do find it strange that a potentially large change that hasn't been included as part of 1.0 alpha will appear in 1.0 beta.

      --
      GLaDOS for President 2016! "Well here we are again. It's always such a pleasure." -- GLaDOS, 2011
    26. Re:Django or Turbogears? by ubernostrum · · Score: 1

      The scary part is, I know the person who filed that ticket... and the person this is assigned to; they're the same person.

      And why is that scary, exactly? Marty wanted the feature, knew what needed to be done and put in the work to write the code. Should we forbid that?

      I do find it strange that a potentially large change that hasn't been included as part of 1.0 alpha will appear in 1.0 beta.

      There's a release roadmap explaining what's being worked on, when it's due, when feature freeze will happen, etc. It's not terribly hard to find (e.g., Google "Django 1.0 roadmap" and it's likely the first result). Alpha had to have all the major features, where "major" is defined roughly as "affects practically everyone who uses Django" (e.g., the admin refactor; the WSGI-handling changes, things like that). The first beta will also be the feature freeze, and has to have every feature; file backends are slated to be one of those features but -- since most people get along just fine without them -- it's kind of hard to argue that it's a sweeping change to Django.

    27. Re:Django or Turbogears? by Anonymous Coward · · Score: 0

      What are you talking about "enter quite deep into the systems' bowels"? All you need to do is "To change this setting, create a file called "custom_zodb.py" in your Zope installation directory. In this file, put the following code:"

      Aside from increasing the threads.

      How is this any different from any other server? I run my Django instances via nginx + fastcgi without any type of auto spawning, which nginx doesn't have, how does it make it any different when I've only 4 fastcgi instances running Django?

      I think maybe if you run Django via CGI it would do, but if the app is large it will slow down. This is why with Zope, django, whatever, you dedicated the hardware and set hard limits. If you run out of threads and the server is to its limits, you set up another server and utilize load balancing.

    28. Re:Django or Turbogears? by Just+Some+Guy · · Score: 1

      What are you talking about "enter quite deep into the systems' bowels"?

      That was a direct quote from the page I linked, describing how to increase the number of database connections.

      How is this any different from any other server? I run my Django instances via nginx + fastcgi without any type of auto spawning, which nginx doesn't have, how does it make it any different when I've only 4 fastcgi instances running Django?

      Our test Django application ran on mod_python on top of Apache 2 with the prefork MPM. 4 threads? While we're not Google, neither are we an unread blog.

      If you run out of threads and the server is to its limits, you set up another server and utilize load balancing.

      We ran out of threads with a load average two machines sitting idle while the reports run.

      --
      Dewey, what part of this looks like authorities should be involved?
    29. Re:Django or Turbogears? by Anonymous Coward · · Score: 0

      Yes, for truly large webapps Django will turn out to be a real mess. (TurboGears, too.) The component based architecture of Zope 3 is the best fit for large and complex stuff.
      If you are scared of the somewhat steep learning curve and/or you want more agility then have a look at Grok which does away with the cumbersome explicite ZCML (XML) wiring.

  5. Currently on sale at Bookpool.com by gorbachev · · Score: 4, Informative

    I just got a newsletter about a sale at Bookpool.com for APress books. APress books are 45% off until 8/31.

    This particular book is $5 cheaper at Bookpool.com than Amazon right now.

    --
    In Soviet Russia, I ruled you
    1. Re:Currently on sale at Bookpool.com by Anonymous Coward · · Score: 0

      Until you add in shipping. Free at Amazon, $3 at Bookpool.com. If you want 2-day shipping then Bookpool.com has better savings.

  6. Spoiler Alert... by Eberlin · · Score: 2, Funny
    SPOILER ALERT!!!

    Storm Dtroopers were imperfect clones of Django.

    Dboba is a perfect clone of Django.

    If you want to stop the Django process, you have to su to Windu and kill -9 Django

    If you're looking for Dboba, try this command: cat \dev\sarlac | grep Mandalorian

    1. Re:Spoiler Alert... by DivineGod · · Score: 1

      made my day

  7. Django n00b by spaceyhackerlady · · Score: 4, Informative

    I recently had a look at web application frameworks for some new development and ended up doing it with Django.

    I find it handy. It's logically put together, the Python back end is fast, and, once you figure out a few basic concepts, you can put web apps together very quickly. The template system is particularly clever. I find that I like to set up my database tables first, then let Django create the model classes. Not the other way around. I also like to do table joins as views in the database, rather than gluing things together in Django. YMMV.

    My last experience with web application development was with Tomcat. I still have nightmares. :-(

    ...laura

  8. Never heard of Django before, now it's everwhere by TimeTraveler1884 · · Score: 2, Interesting

    Only a day ago I would have been asking the same question. I have been a long time Java Developer and decided to trying deploying an application to the Google App Engine. Unfortunately, for me at least, only Python is supported so I have been forced to take a deeper look into Python.

    The Google App Engine already has the Django libraries available. It's seems like a pretty useful template system, however I really wish they had chosen to use xml tags instead of parenthesis tags so that native xml tools, even browsers would display and work on the raw template more effectively.

    On a side note, I have a question for any Java to Python converts out there. I am using Pydev for Eclipse, but I am missing the compile-time checking of static types, method signatures, etc. I've already experienced a few cycles of correct, save and repeat to find simple typos. I feel like I am back in the days of when I was Perl hacking. I know if I had unit tests for this it would make things a little better, but unit tests can't always cover 100%. Until I get to try the junit equivalent for Python (whatever that is), how do the rest of you deal with finding bugs that would have been compile time errors in other languages?

  9. The book may be out of date soon. by Mrs.+Grundy · · Score: 1

    I'm just finishing up a project with django. It is a lot of fun, quick, and useful. It is very well designed. One issue, however, is that it is still changing rather quickly. Things in version .95 or .96 can be substantially different than the current development version. This isn't unusual for such a young project, and since the documentation is quite clear and useful it's not a problem, but is something you may want to consider before you plunk down your hard-earned cash on a printed book.

    1. Re:The book may be out of date soon. by ubernostrum · · Score: 5, Informative

      One issue, however, is that it is still changing rather quickly. Things in version .95 or .96 can be substantially different than the current development version.

      Hi, I'm James and I wrote Practical Django Projects, and I have a confession to make: I cheated while writing the book. You see, I'm also Django's release manager, which meant I had a good idea of what would land in trunk and what would change by the time we went to press. Except for activating/hacking on the admin interface (the admin refactor just landed over the weekend), everything in the book should be up-to-date and usable on the Django 1.0 alpha we released Monday.

    2. Re:The book may be out of date soon. by number6x · · Score: 1

      Cool!

      Thanks for the update.

    3. Re:The book may be out of date soon. by Joe+Tie. · · Score: 1

      That actually is good to know. The api changes are the main reason I'd be hesitant to buy any book related to django at the moment. I might actually pick this one up now.

      --
      Everything will be taken away from you.
    4. Re:The book may be out of date soon. by Daimaou · · Score: 1

      You are right! Things are changing in Django; however, I don't think this is a particularly big problem since Django is currently looking mostly as it will when 1.0 is released.

      Also, I have the book and isn't one of those Volkswagen sized Wrox cubes. It can easily be digested within a couple of weeks so you can get what you need now and be prepared to migrate to new features in the future.

      I highly recommend this book to people wanting to learn Django. It is better than most of the other Django books available today, I think.

    5. Re:The book may be out of date soon. by Fnord666 · · Score: 1

      Except for activating/hacking on the admin interface (the admin refactor just landed over the weekend)

      Yeah thanks. I had been working with ROR for some time and decided to give Django a try. I was working through the Django book just fine until I hit the admin pages section. After a few hours of frustration I did a little web search. Wouldn't you know it, within the last 48 hours someone had dropped a refactor of the admin system into the trunk right before I picked it up.

      This is why I don't do production work with newer frameworks like these. The next time I need to change something, half of my application could be broken!

      --
      'The tyrant will always find pretext for his tyranny.' - Aesop's Fables
    6. Re:The book may be out of date soon. by wcbarksdale · · Score: 1

      Why would you be doing production work with a trunk version of an external library?

    7. Re:The book may be out of date soon. by ubernostrum · · Score: 1

      This is why I don't do production work with newer frameworks like these. The next time I need to change something, half of my application could be broken!

      This is why we have a document explaining which APIs are finalized and which may change prior to 1.0.

    8. Re:The book may be out of date soon. by omuls+are+tasty · · Score: 1

      So you're describing the newforms-admin in the book?

    9. Re:The book may be out of date soon. by the_rev_matt · · Score: 1

      Thanks for the clarification. And ++ on the sig :)

      --
      this is getting old and so are you

      blog

    10. Re:The book may be out of date soon. by Fnord666 · · Score: 1

      This is why we have a document explaining which APIs are finalized and which may change prior to 1.0.

      You mean the document that lists django-admin in the stable API section of this document? The section that starts off with:

      What "stable" means In this context, stable means:

      • All the public APIs -- everything documented in the linked documents, and all methods that don't begin with an underscore -- will not be moved or renamed without providing backwards-compatible aliases.
      • If new features are added to these APIs -- which is quite possible -- they will not break or change the meaning of existing methods. In other words, "stable" does not (necessarily) mean "complete."
      • If, for some reason, an API declared stable must be removed or replaced, it will be declared deprecated but will remain in the API until at least version 1.1. Warnings will be issued when the deprecated method is called.
      • We'll only break backwards compatibility of these APIs if a bug or security hole makes it completely unavoidable.

      Got it. Thanks.

      --
      'The tyrant will always find pretext for his tyranny.' - Aesop's Fables
  10. Why re-invent the wheel? by JustShootThemAll · · Score: 3, Insightful

    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.

    1. Re:Why re-invent the wheel? by darkpixel2k · · Score: 1

      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.

      That's like saying that 'toilets' were solved years ago. Just go out to the outhouse and take a load off.

      Although the problem was 'solved', someone came along and did the whole indoor plumbing and a porcelain toilet thing.

      Same thing with web frameworks. Both perl and python work well. Python just works better.

      I'm sure whatever comes after Django in a few years will be even better.

      --
      There's no place like ::1 (I've completed my transition to IPv6)
    2. Re:Why re-invent the wheel? by Anonymous Coward · · Score: 1, Insightful

      AFAIK the Romans did the toilet thing more than a few years ago.

  11. Does anyone even read physical books anymore? by LS · · Score: 2, Insightful

    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

    --
    There is a fine line between being a cultivated citizen and being someone else's crop. - A. J. Patrick Liszkie
    1. Re:Does anyone even read physical books anymore? by bloobloo · · Score: 2, Interesting

      I find books invaluable. Perhaps it would be different if I had 2 screens and I could put an editor on one screen and the tutorials on another, but as it stands I find it easier to flip pages to find what I am looking for.

      Unless you're copying code fragments, I don't get the benefit (other than portability) of a soft copy over a hard one.

    2. Re:Does anyone even read physical books anymore? by Anonymous Coward · · Score: 0

      I read the O'Reilly "learning" books (java, python) as a way to get myself to the point where I would be comfortable using API references.

      I may be fairly good with both languages now, but I still find myself reaching for one of the books now and then to ask things like "now I knew there was something that could do this..."

    3. Re:Does anyone even read physical books anymore? by Anonymous Coward · · Score: 0

      The thing is that on the internet you get a bunch of hacked together solutions from people with a wide variety of expertise and background. While this is nice for the "democratic" part of programming, it can also result in lower quality code.

      Most people pick a solution for their problem that some blogger posted and run with it, without really understanding what it's doing or if it's even the best implementation.

      Plus, since anyone can post, anyone does...which can lead to all sorts of confusion or just plain weirdness/misinformation.

      Books by experts still have a value in imparting Best Known Methods and workflows, good style and technique, and (with a good editor) a structure conducive to conceptual understanding, instead of the hack and fix model.

      It's the difference between going to school and spending all day reading wikipedia articles. For some structure matters, for some it doesn't.

    4. Re:Does anyone even read physical books anymore? by Just+Some+Guy · · Score: 1

      I bought a copy but I ended up using a pirated digital copy anyway because it was more useful...

      I prefer chocolate. Does anyone even eat vanilla ice cream any more?

      I can't grep a dead tree, but neither can I read much of an ebook without getting a headache. That makes the printed version much more useful to me. It's just a preference.

      --
      Dewey, what part of this looks like authorities should be involved?
    5. Re:Does anyone even read physical books anymore? by LS · · Score: 1

      It's not necessarily true for all projects, but many of them have extensive documentation. Documentation written by the team that created that project is quite a bit different from a blogger's code snippet.

      Also, I'm not railing against the structured book format, just the printed physical book.

      LS

      --
      There is a fine line between being a cultivated citizen and being someone else's crop. - A. J. Patrick Liszkie
    6. Re:Does anyone even read physical books anymore? by LS · · Score: 1

      It's not that simple. William Gibson writes his books on an old typewriter. He can get all condescending and miss the point and say it's just his preference but the reality is that there are several advantages to using a word processor. He can continue to use his typewriter but most people have moved on.

      I don't have anything against people who use books. I'm just wondering if anyone actually uses them and why. Apparently you still do, and it's because of your eyes.

      --
      There is a fine line between being a cultivated citizen and being someone else's crop. - A. J. Patrick Liszkie
    7. Re:Does anyone even read physical books anymore? by Just+Some+Guy · · Score: 1

      It's not that simple. William Gibson writes his books on an old typewriter. He can get all condescending and miss the point and say it's just his preference but the reality is that there are several advantages to using a word processor.

      Conversely, there are several disadvantages to using a word processor. I think Gibson would argue that every single feature not directly related to writing words is a distraction he doesn't want, and there's a lot to be said for being forced to plan your thoughts before committing them. I don't necessarily work that way, but it really is a style preference.

      Apparently you still do, and it's because of your eyes.

      That was the "easy" reason. Others:

      I've never found a bookmarking system as easy as a physical bookmark, and a yellow highlighter is an easier marking tool than any other I've seen.

      Books don't need electricity and don't break if you sit on them, making them better (in my opinion) on trips. I've definitely never read an ebook in the bathtub.

      No cute girl in a coffee shop ever asked me what ebook I was reading.

      I don't have anything against digital text, and I loved php.net's docs back when I was stuck writing in that language. Given a choice between an electronic or physical version of the exact same text, though, I'll usually pick the book.

      --
      Dewey, what part of this looks like authorities should be involved?
  12. what a coincidence! by bedonnant · · Score: 2, Funny

    in a flabbergasting coincidence that will leave you all wondering about Fate, i just received my copy of this book today, and was at this very minute beginning to read it. my life has just been slashdotted.

    --
    ~~~ Paf. Le chien.
  13. Django Jobs by daeg · · Score: 2, Interesting

    We're running Django for basically our entire business systems. It's great. The only downside to Python is that there is a general lack of local developers (Tampa, Florida). Trying to find additional developers when you can't get relocation benefits approved is a royal PITA. (Anyone looking for a job in Tampa? =))

    We're very, very happy with Django.

    1. Re:Django Jobs by Daimaou · · Score: 2, Insightful

      I'd be happy to telecommute. :)

    2. Re:Django Jobs by Anonymous Coward · · Score: 0

      Which part of Tampa?

    3. Re:Django Jobs by daeg · · Score: 1

      Downtown - Harbour Island.

  14. 1.0 Real Soon Now by the_rev_matt · · Score: 4, Informative

    Note that Django 1.0 is due this fall and it looks to be actually on track. I used Zope for personal and freelance projects for about 9 years and professionally for about 2. I migrated my site and the majority of the content over in about a week, and that included the process of learning django.

    I will note that one of the things I liked about Zope was the admin interface, which was clunky and minimal but a far sight better than what most other app servers had at the time (late 90's/early 00's). Django's is immensely better.

    I've also Read The Fine Book reviewed here and concur with the reviewer. This book is a great introduction to a useful tool.

    --
    this is getting old and so are you

    blog

  15. Significantly better than Zend? by JakeD409 · · Score: 2, Interesting

    I'm about to start a mid-sized project that I'd like to use a framework for. I'm planning on using the Zend Framework, since I know PHP very well. I do not know Python, but it's very high on my list of languages I'd like to learn (like, number 1).

    Would it be worth my time to learn Python and then do the project in Django? I'm experienced enough in OO and various languages that I don't think Python would take me too long to pick up, but is the learning curve between knowing Python and using Django steep enough that it cancels out the benefits of using Django over Zend (if there even are any in the first place)?

    1. Re:Significantly better than Zend? by imbaczek · · Score: 1

      Depends on the project, as usual, but IMHO yes, Django is worth a try. I haven't used Zend though, so YMMV (particularly, I don't know what features you may expect from a framework.)

    2. Re:Significantly better than Zend? by Balinares · · Score: 4, Informative

      Firstly:

      > I'm planning on using the Zend Framework

      I understand the Zend Framework is not so much a framework as a tight collection of helper tools. If you want a framework, as in, framework, you'll probably want to look into CakePHP. Symfony is more powerful, but also kind of more complicated. (And declaring my models in XML makes my skin crawl -- but it's just me.)

      Secondly:

      > Would it be worth my time to learn Python and then do the project in Django?

      Short answer: If you know PHP really well and it works for you, it'll be less work (and less risk) to just keep using PHP.

      Long answer: If you're a fast learner, and intend to keep using Django afterwards so the overhead of learning it is worth it, then I'd say, absolutely. If I were in your shoes, I believe I would probably create a small functional site in Django in my spare time -- it doesn't take very long at all to get a blog with comments up and running, for instance -- and see how it flies with me. I understand learning Python and Django hand in hand works very fine, although I can't personally comment on that, having been into Python for many years.

      If you go the Django road, you'll probably find these resources handy:

      The Django community aggregator is at http://www.djangoproject.com/community/ and has many good posts with great insight on how to get the best out of your new Django toy.

      The Django Snippets site at http://www.djangosnippets.org/ is a great catalog of small, useful bits of code. I read it in my RSS aggregator, personally.

      And of course, there's the #django IRC channel, and the various mailing-lists.

      Enjoy exploring Django! I've been following it for a few months already and still don't hate it, and for an old bitter bastard like me, that's the biggest praise.

      --

      -- B.
      This sig does in fact not have the property it claims not to have.
    3. Re:Significantly better than Zend? by Daimaou · · Score: 1

      I have used Zend and PHP and I think Django is easier to program in and the framework strongly encourages good programming practices.

      Python is easy to learn and Django apps run significantly faster than PHP-based apps (at least this has been my experience).

      As a side note, if you decide to use Django and/or Python, I would recommend getting either the WingIDE editor from WingWare (expensive) or the PyDev Extensions plugin for Eclipse (fairly cheap). Both of these provide code completion and can really help boost your learning by reminding you of what's available and how it works.

    4. Re:Significantly better than Zend? by drewtheman · · Score: 1

      Symfony is more powerful, but also kind of more complicated. (And declaring my models in XML makes my skin crawl -- but it's just me.)

      It's true that 2 years ago you had to declare your model with xml, but yaml files are now used, a parser does the work to translate them into xml for you. Yaml files are very human readable and you can write your entire model in a blast, as long as it is already planned.

      And being a Symfony user since the very beginning, I can tell you that Symfony is indeed very powerful. And that Yahoo bookmarks was developped using it, it says a lot.

    5. Re:Significantly better than Zend? by entropiccanuck · · Score: 1

      I learned Python and Django at the same time. I needed to transfer some existing apps for the company I was with, and decided to play around with Python/Django to see how that would work. I'd been out of the development/programming thing for a few years and had extremely minimal Python experience, but within a couple weeks I was much further on my projects than was anticipated. Perhaps it's just me, but Python and Django just made sense.
      Django's documentation was accurate and thorough, which helped tremendously. Particularly, the Django book was very helpful and I'd recommend it to anyone interested in Django. (disclaimer - was using the beta version of the book)

    6. Re:Significantly better than Zend? by Anonymous Coward · · Score: 0

      Use Drupal. It's like PHP, but with all the shit bits papered over. It's also a proper framework, unlike Zend.

    7. Re:Significantly better than Zend? by weierophinney · · Score: 1

      Caveat: I'm a Sofware Architect with Zend Framework.

      You're characterizing ZF incorrectly. It is _both_ a library of uncoupled components _and_ a full-stack framework. It's quite clear that you've never used it and are in fact letting the blogosphere do your thinking for you. Additionally, while CakePHP and Symfony are both full-stack frameworks, Symfony is moving towards a more loosely coupled architecture now. Also, Symfony uses Yaml for configuration, not XML.

      I personally never recommend one framework or language over another. You should always evaluate your application and business needs, and determine what tools will solve those best. Recommending a tool to somebody without telling them _why_ they might want to use it does nobody any good (for instance, why use CakePHP? Answer: convention over configuration, leading to RAD; PHP 4 compatibility; etc.). Answer the questions you do know, please.

    8. Re:Significantly better than Zend? by Anonymous Coward · · Score: 0

      If you're familiar with a good PHP framework such as CodeIgniter or CakePHP (never used Zend myself), it isn't such a big deal to make the switch. Especially if you've used the alternative syntax. Python is ridiculously easy to learn. Just go and give it a shot!

    9. Re:Significantly better than Zend? by Balinares · · Score: 1

      Greetings,

      Thank you for taking the time to post your own opinion!

      Perhaps you will forgive me to point out that your assumption is mistaken: the view I posted regarding Zend Framework comes from internal company research. You are indeed correct in that I didn't choose to use ZF personally, but are mistaken in your assumption that my views are based on simple hearsay rather than actual first-hand investigation.

      However, I find your comment about the blogosphere interesting, because it raises two questions:

      Firstly, am I to understand that ZF doesn't meet the expectations for a 'true' framework, whatever that means to each individual user, in the blogosphere at large either? I'll admit to you that I do not follow the PHP blogosphere and I thus have no opinion on that either way.

      Secondly, while I of course can't rule out the possibility we failed to give ZF due credit in out research, if a significant number of people indeed came to the same conclusion we did, wouldn't you say it possible that this conclusion has some grain of truth to it?

      I am not comfortable pushing this matter a lot further because obviously you care a lot about your product, and it seems like the opinion that users such as ourselves came to form about it is profoundly disagreeable to you. However, perhaps you will forgive me for suggesting you take a step back and consider the possibility there might exist some leeway for you to improve your product, so that it better matches the implicit expectations that your users have for what constitutes a framework? I fully acknowledge the possibility it's us who came to the wrong conclusion; whether you'll choose to consider the other possibility, however, is your own decision.

      Thank you for reading.

      --

      -- B.
      This sig does in fact not have the property it claims not to have.
  16. Re:Never heard of Django before, now it's everwher by Just+Some+Guy · · Score: 2, Informative

    pylint. It has some annoying style checks that I often disable, but is good at finding unused and undeclared variables and that sort of stuff.

    --
    Dewey, what part of this looks like authorities should be involved?
  17. Django has more than a wheel by Anonymous Coward · · Score: 5, Informative

    I have some experience using mod_perl & Django in mod_python. Django provides much that perl does not, and I love writing perl for backend utilities and CGI.

    Django templates do not allow the scriptlet mentality of others like JSP & mod_perl. They have a short list of commands, a loop, an IF-statement, and some text filters. This forces users to separate computation (in perl/python code) from display (in the template). The template takes a dictionary of named (keyed ) objects and prints the fields.

    Django has an Object-Relational Model built-in to the system. Programmers write a models.py module full of ORM classes. Then, the Django utilities build SQL database tables to match the models. The Django Object-Relational Model has no equal so far as I've seen.

    Django enforces the MVC web application. Most other web frameworks let the bad habits creep in.

  18. In related news by dedazo · · Score: 3, Informative

    After a loooong time, 1.0 Alpha was just released.

    --
    Web2.0: I love when people Flickr my cuil and digg my boingboing until my google is reddit and I start to yahoo
  19. Re:Never heard of Django before, now it's everwher by imbaczek · · Score: 2, Informative

    there are tools like pychecker, they help quite a bit. junit is right there in the standard library of python, see docs for the unittest module; there's also the doctest module for simple cases.

  20. Frontend UI questions by neuromancer2701 · · Score: 1

    I just started messing around with python and I am impressed with how easy it is to get started. I looked over Django a couple of times and was just clueless. Is Django just a backend framework? Do all the frontend UIs need to be done in html/xhtml? I couldn't see anything in the documentation about assisting with UI design. Thanks

    --
    "If you like Battlestar Galactica, you're probably a huge nerd." -Stephen Colbert
    1. Re:Frontend UI questions by Teilo · · Score: 1

      Like most web frameworks, Django uses a template library to generate HTML. That is to say, it includes special tags and helper functions to wire your UI into request/response objects and database models. You still need to know HTML/CSS, etc. You have to provide your own JS/AJAX libraries, as Django, as a matter of philosophy, does not endorse/support/provide any JS libraries of any kind.

      It does have something called "generic views" which can provide basic CRUD and various common views (such as date-based views). However, these are more for prototyping, and would generally be replaced in a production app with something more custom.

      --
      Mir tut es leid, Menschen daß Einfältigfehlersuchenbaumfolgendenaffen sind.
    2. Re:Frontend UI questions by ubernostrum · · Score: 1

      It does have something called "generic views" which can provide basic CRUD and various common views (such as date-based views). However, these are more for prototyping, and would generally be replaced in a production app with something more custom.

      I have a crap ton of production code built around generic views. They're in Django precisely because things like "show a detail view of one object" or "show all objects from March 2006" shouldn't require you to be constantly writing and re-writing code: the repetitive parts of the logic can and should be encapsulated in a generic handler. In the book I cover some examples of how to take advantage of this by using the various supported parameters or writing short one- or two-line wrappers around generic views, and I've got an older (but still perfectly working: hooray API stability!) blog post covering the same topic.

  21. Re:Never heard of Django before, now it's everwher by Vornzog · · Score: 4, Informative

    The Google App Engine already has the Django libraries available.

    Have a little care, there. The GAE caused quite a stir in the Django community, because it is only a partial implementation of the database interface that Django normally uses. It is backed by BigTable, which is blazing fast, but not a full blown relational database. If that works for you, go for it - it looks like a sweet platform for certain kinds of projects.

    As for your question about Java->Python, I'm a former C++ convert myself, but I can help a little here. For some 'compile time' checking, look at PyLint It may check too much for you, but you can turn off the stuff you don't want.

    As for unit testing, PyUnit is a pretty straight port of JUnit, so that should look familiar. However, I actually find nose to be a little better. It has many of the same capabilities, but with less boilerplate needed, and it integrates well with any existing PyUnit or DocTest tests.

    --

    -V-

    Who can decide a priori? Nobody.
    -Sartre

  22. Python is quite dynamic by Anonymous Coward · · Score: 0

    Python objects are dynamic the way Javascript ones are. It's possible to define a new method, or a field, on an object at any time. The interpreter doesn't know ahead of time the way Java can.

    Type errors are one thing you can control. Since a Python variable can contain ANY object type, you may set it to the NULL value for that type you want.

    my_dict = {}
    my_dict[key] = value

    my_string = ''
    my_integer = 0

    You may pre-define class fields as well. Django requires a models database field to be declared! Use the Python "property" function to calculate other fields withe getter & setter functions.

    class Sample:
        my_field = 100
        my_sqrt = property(get_sqrt, set_sqrt)
        def get_sqrt(self): return sqrt(self.my_field)
        def set_sqrt(self, value):
            self.my_value = value*value

    The my_sqrt field is calculated as the square root of the my_field field. You may use the obj.my_sqrt in Django templates easily.

  23. None of those projects are any more mature. by Anonymous Coward · · Score: 0, Flamebait

    1. Perl is a mess.

    2. Rails is a mess.

    3. Python isn't a mess.

    4. Hopefully one of the emergent frameworks on python won't be a mess ... django isn't ... and it's pretty mature at this point ... and has been for about a year or so ;)

    1. Re:None of those projects are any more mature. by Anonymous Coward · · Score: 0

      First of all, Rails is NOT a language. It's a framework. You can't compare it to languages like that. Second of all, Python has some problems just like the rest of the scripting languages you're referring to. Super slow lookups for one, and a horrible extension system for C for another.

  24. Dwango by yoinkityboinkity · · Score: 1

    Does this make anybody else think of Dwango?

    "Dial-up Wide-Area Network Game Operation"

    It came with Doom.

    Link

  25. Search... by megalomaniacs4u · · Score: 1

    The big advantage of a soft copy of book is being able to do searches for keywords which is invaluable when you don't know which set of terminology the author is using and the index doesn't cover the word or phrase you require.

    Note this is particularly invaluable in API references - particularly with php when you have no clue which daft name php uses for a function, but you are sure that php has function for that job.

  26. Re:Never heard of Django before, now it's everwher by TimeTraveler1884 · · Score: 1

    Just wanted to say thanks for the links and information. I'll be sure to read the Python documentation more, but it's always helpful to get some advice. Cheers.

  27. Great Book!!! by chrisdev · · Score: 2, Informative

    I got this book last week and it's worth the money!! I was having trouble with custom templates tags. After reading The Definitive Guide, writing filters and include tags were easy but the examples given for custom tags were too complex to start off with. However, when i saw James' examples (latest_entries) it all clicked !!! I've already written some custom tags to generate charts from ChartDirector Also i wish i had read his CMS stuff when i first started django it really shows you how to leverage the flat pages By the way his B-List blog (http://www.blist.org/weblog/categories/django/) also kicks ass!!

  28. Re:Django has more than a wheel by Intron · · Score: 1

    All of the features that you list seem to be about limiting the options of the programmers rather than extending the capabilities of the base language.

    Any time that I hear that something is going to "force me to do it the right way" I know that the first project I try to use it on will need to do something the wrong way. If a tool provides a great way of doing something then it shouldn't need to force me to use it, I would use it that way naturally.

    --
    Intron: the portion of DNA which expresses nothing useful.
  29. Django by Anonymous Coward · · Score: 0

    Django is a Boss-DJ

  30. Re:Django has more than a wheel by pimpimpim · · Score: 1
    I think stuff that limits options has a good place in about half of the websites on the internet. Think about the immense amount of small businesses. They don't want to hire a developer, but still might want an online shop. There are now many places where the whole template including secure payment system is provided by the host, and you just do the layout part. In such and similar cases, limited options are a blessing for all involved. The shop doesn't need to invest time, and you as a shopper are faced with a professional site that works.

    Then there is the other half of the internet, doing fancy web 2.0 stuff etc. There the problem of the limited options is that at some point you will need to start to make workarounds, and the whole "clean" software becomes a huge mess. Actually, I just yesterday tried to apply online at a company, but their SAP-Web-Service Registration package was such a mess of different login procedures that I couldn't finish the registration, or even log in again. Or get my password again. Since we are talking multinational company here, I am really amazed why they used such a limiting package for this. And a bad one at that. Message to them and others: If you want to do fancy stuff, please do it yourself with decent, flexible, relatively low-level tools, where it is clear exactly that it is doing what you programmed it to do.

    Perl-wise: I wrote my own SQL-based CMS site from scratch in perl, in about 3 days. This included testing several of the CPAN packages for SQL interaction and automated layout.

    --
    molmod.com - computing tips from a molecular modeling
  31. Django swings, baby by enystrom · · Score: 1

    Django Reinis one of the most influential jazz guitarists of all time. Lived in Europe in the 1930s-40s, played with two fingers on one hand because he was burned in a fire. See Wikipedia, though it's tough to appreciate him without hearing it live. The Modern Jazz Quartet's best-known tune was titled Django.

    1. Re:Django swings, baby by enystrom · · Score: 1

      Bah! Django Reinhardt, of course.

  32. Look out down under... by Anonymous Coward · · Score: 0

    'Cause maybe a django ate your baby!

  33. Re:Django has more than a wheel by mabhatter654 · · Score: 1

    tell the truth, there's very little related to the web that can't be done with RPG III. That's been obsolete for 10 years and runs on AS400's... What's needed on the web is not "more power" but more structure to work quickly, be reusable, and manageable 3 years later. That's why RPG is still used, because you can pick up a 15 year old program and the formating and instructions are so rigid there's little room for interpretation of what the program does. Systems like AS400 became popular because they presented one way to write programs, one screen model, one data entry method, and one pool of data... Things like Ruby on Rails in my opinion are trying to create a new "default" structure in the web world... any structure.. so programmers focus on filling in the boxes/structures with what the end client wants rather than creating "clever" re-inventions for every project.

    I think Java has fallen down because there's so many "great" ways to do non-trivial stuff.. and they're so big it takes years to learn one of them properly.. then they make new non-compatible replacements and developers start all over! PHP in some ways already suffers the same problem... too many middleware templates but none widespread enough to call "standard". Ruby on Rails jumps in and grabs the spotlight because it's "done" for no other reason. Somebody put all the pieces together, made the tough calls without asking "permission" and then turned it loose. People may not agree with all of it, but it's ready to start work. Django looks like the same tool set, with more focus on the end page content, for Python, but does it have the code management Rails has?

  34. Re:Django has more than a wheel by ubernostrum · · Score: 5, Informative

    All of the features that you list seem to be about limiting the options of the programmers rather than extending the capabilities of the base language.

    Devoid of context, yes, I can see that.

    In context, however, not so much. Consider Django's built-in template system (which you don't have to use, btw; most people do because it leads to easier interoperability with arbitrary applications, but you're free to drop in whatever you like -- it's just Python code on the backend); most people instinctively get upset when they find out that it isn't just the host programming language embedded into HTML (a la PHP, ERB, "classic" ASP, etc.). But I've found that it's extremely rare for me to have a need for such a thing, and when I do the template system is extensible from the Python side, so I can implement what I need and get on with life. A good example I ran into the other night while helping someone debug: he was doing a product-review site where each product had a government-issued safety rating, from one to five stars. What he wanted was basically a way to say something like:

    {% if product.safety_rating > 3 %}This product has a high safety rating.{% endif %}

    (the curly-brace constructs are how Django's template language delimits certain constructs, such as conditionals, loop expressions, etc.)

    Now, you can't actually do this: arbitrary Python expressions like product.safety_rating > 3 aren't supported by the language. What he ended up doing was moving this logic into a method on the object representing products, so it became if product.has_high_safety_rating instead. For most cases in most applications, this is a better option (it's more reusable, and leads to easier maintenance since you don't have magic numbers hard-coded everywhere). And for times when you need it, you can dip down to the Python level and extend whatever syntax you need into the template system (one night I sat down and implemented a bunch of comparison expressions; it took about five minutes).

    The parent comment you're responding to is also slightly incorrect on a few points; for example, Django doesn't "enforce" MVC in any particular way and actually deviates from it in some ways that made sense for the Web (e.g., the concept of the controller really has no place in most web applications, since there's only a single channel for interaction with the app: HTTP). All Django cares about is that for each URL you want to handle, you provide a callable object which accepts an HTTP request as its first argument and returns an HTTP response. Beyond that, the sky's the limit. Django also doesn't force you to use its ORM; several of the bundled applications in django.contrib make use of it (since, if you've got Django installed, they can rely on the ORM being available), but nobody says you have to use it in your apps.

  35. Search system? by omuls+are+tasty · · Score: 1

    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 quote from the author's djangosnippets.org:

    Why isn't there a search system?

    Because no-one's yet written a good generic search system for Django. When somebody does, I'll look into adding it.

    ;)

    Anyhow, I've been using Django for a bit less than an year now. It really is great, strips away lots of boilerplate code but at the same time is quite extensible for the most part. It can still give you headaches occassionally, but a lot of work has been done on decoupling the components and other enhancments. From what I understand, the new "newforms admin" which has just been merged into the trunk should go a long way to help with extending the back-end interface, though I haven't used it yet. Other things still leave something to be desired, e.g. the permission system is really basic etc.

    All in all it's a super product, and the online documentation is one of the best I've ever seen. It's nice to see an addition to it in the form of this book, especially considering that the author is a real Django "insider" and knows what he's talking about

  36. Hahaha by omuls+are+tasty · · Score: 1

    Look at this book:

    Pearl Django Play-Along Songbook
    By Greg Ruby

    Pitty they misspelled "Perl" ;)

  37. Other Django books? by Anonymous Coward · · Score: 0

    The book reviewed sounds OK. I found "Sams Teach Yourself Django in 24 Hours" to be a fast way to get up to speed on Django. Anyone have recommendations for other Django books?

  38. Re:Never heard of Django before, now it's everwher by ubernostrum · · Score: 1

    Just to follow up: Python has two flavors of tests -- unittest, which was originally the PyUnit software you've already been pointed to, and doctest which lets you write interactive examples -- and Django's test framework has baked-in support for both of them, along with extension points to plug in your own system if you prefer. There's also a dummy HTTP client which can send requests and inspect the responses being sent back (including verifying data-processing from the backend), and a co-worker of mine has released some software which generates a test suite from a live browser session to ease creation of your tests.

    Personally, I've always felt that Python's doctest system is one of the greatest things since sliced bread; for example, it lets us produce a single document which in one context can be processed as API documentation but, in another, is executable as a unit test suite for the features it's documenting.

  39. Re:Django has more than a wheel by Zarf · · Score: 1

    Django has an Object-Relational Model built-in to the system. Programmers write a models.py module full of ORM classes. Then, the Django utilities build SQL database tables to match the models. The Django Object-Relational Model has no equal so far as I've seen.

    Django enforces the MVC web application. Most other web frameworks let the bad habits creep in.

    You have just given the exact same list of reasons I chose to use Groovy/Grails over Ruby on Rails. You have peaked my interest. So I will definitely have to take a look at Django. Especially now that there is a Django plugin for Grails: http://www.grails.org/DjangoTemplates+Plugin ... I have a couple of toy projects I may choose to do in Django to get a feel for the framework...

    --
    [signature]
  40. Re:Django has more than a wheel by perrin_harkins · · Score: 1

    Django provides much that perl does not

    No, it doesn't. You just don't know perl's tools. For example, the "scriptlet" thing you mention has nothing to do with perl -- it's a feature of some specific framework you chose. Perl's Template Toolkit is very similar to Django templates, and perl has great ORM tools like Rose::DB::Object.