June 2009 News Update: The second edition of this book has been released!
The 2nd edition of Practical Django Projects has been released making this series of posts redundant!Notes and a practical companion
I've been reading James Bennett's excellent Practical Django Projects (PDP), which uncritically I think is the best python based book I've read since I picked up Mark Lutz's Learning Python in 1999. Unfortunately for James the arrival of Django 1.x breaks code examples in the book, which may frustrate the target audience for the book who are likely to be new to Django, and possibly python. On the other hand, if the reader has some basic prior python experience, then there is nothing like learning an application when you have to update the code, and the users mailing list, and Django docs are excellent resources to this end.But for those budding Django users who might be less inclined to wade through google searches on the django-users list, and to avoid others repeating themselves I thought it would be worth posting some revisions of the code samples as I work through the chapters, and also add some footnotes to James's text where I think they'd be useful to other readers. As I do each chapter, I'll add in a new post if I have anything to add and create a link from here.
- Welcome to Django
- Your First Django Site: A Simple CMS
- Customizing the Simple CMS
- A Django-Powered Weblog
- Expanding the Weblog
- Templates for the Weblog
- Finishing the Weblog
- A Social Code-Sharing Site
- Form Processing in the Code-Sharing Application
- Finishing the Code-Sharing Application
- Writing Reusable Django Applications (I will not be doing a post for this chapter)
Now for the disclaimer. As someone who has had no prior experience with Django, I don't claim any authority on the 'Django' way, and invite anyone to comment if they have a better solution.
UPDATES
29-Aug-08 - Rev Pt4. Django-tagging has been updated and the trunk works with 1.0 Beta 2
5-Sep-08 - Rev Pt5. Updated to modify category view
16 comments:
Thanks Brett for doing this!
I have been quite frustrated by the lack of support (source code & errata) at Apress, as I have also been using 1.0 alpha and find that everything takes longer to do in than it should, as I have to figure out what the workaround for 1.0 is.
Thank you Brett for this addition to the book..I agree it's a good one.
That said, it would be very helpful if Apress got the source code and errata sections of the book site posted. The book was released in June and it's nearly September.
I've struggled figuring out the proper dev version[s] needed to complete the examples as provided in the book.
Agree totally with ms_jen, this is taking too long though also a good exercise in learning to debug basic Django issues.
Mr. Bennett could simply state what trunk revision number he used to test the examples in the book. He doesn't include this info.
I've used several revisions, somethings work one way then break if another revision is used.
I could be wrong, but I'm guessing Apress pushed the button on this book before the timeline for the release of 1.0 was set down, which given how long people have waited for 1.0 would have seemed reasonable. In retrospect it probably would have been better to hold this book back and revise it for 1.0.
Until the dust settles on 1.0 it's best to svn co the development trunk and use svn update regularly to pick up bug fixes.
As far as I've seen thus far the only real breakage is with newforms admin which went into trunk at changeset 7967. I guess if you wanted to follow the book without newforms admin you could delete your django directory (for safety) and then run a new svn co http://code.djangoproject.com/svn/django/trunk/ django-trunk -r 7966.
I'd like to thank you for this also. I was already halfway through the book and it was getting frustrating.
Some small detail cold easily take me 1hr to figure out. You have made good book a lot less annoying to me.
Thank you very much!
Muchas gracias Amigo!
Thanks you so much for doing this.
If only I had come across it 3 months ago!
Thanks again!
Brett,
Many thanks. This has helped me. Have you posted the complete source code anywhere for the blog?
I'm sure many folks would find it useful.
TIA
ldm616, I had hoped that James would publish his source code by now, but that aside, it's unlikely APRESS would grant me permission to publish the source code since 99% of it comes from the book itself. We can only hope that James is refreshed and ready to tie off this loose end.
This is a potentially useful alternative to the books blog app. Very similar but the source code provided seems to work (at least so far, I'm not done with it yet): http://www.webmonkey.com/tutorial/Install_Django_and_Build_Your_First_App
Thank you *sooo* much.
Awesome stuff. I got this book a couple of months ago and kept getting stuck with the code breaking. Managed to suss it out after a marathon session of googling a couple of nights ago, but looks like you have all the issues ironed out here.
I am so going to bookmark this. Thanks!!
Wow, this is really helpful for me. Many thanks :)
Thank you so much for going out of your way and documenting this! James Bennett should buy you a beer for doing his work!
Found a copy of this book heavily reduced at a local bookstore and picked it up (not realising WHY it was so marked down), and the comments part of the blog was a little baffling. This series of posts is quite helpful, given I don't have access to the second edition of the book. =)
Man, I can't be more thankfull. I have 2 weeks ripping my hair off with the 2nd edition of pract. dj.
I think I never was so frustrated in my whole life. I also sent a message to James Bennet to his bitbucket account begging for some help.
I am really newbie in django (also in python), but I just loved it at first look, and now I want to know everything :P.
You could open a branch of the book code, or start a new one if Bennet is ok with that...
Thanks a lot for doing the corrections.
Best Regards.
Pedro
I found the examples worked okay for me. Sometimes I made small mistakes that took ages to work out. But after the CMS app, I started a Django app from scratch, just to see how far I got, and was pleasantly surprised. But it isn't easy, and the errors in the printed code really should have been corrected before going to press. That's when - at page 68 - I found your labour of Django love, and was truly thankful. As for the corrected code, I was just going to put all the working code (or at least the blog, which is better than the - quite nice and easy to get running but slightly lacking - Webmonkey app) up on my Github account when done, with some prettifying CSS. And IIRC, after version 1.0 Django is backward compatible, so everything in the second edition should work if you're using Django 1.* and so far I've found it does. Except for the typos (which it's good to try to figure out for yourself, and then arrive here, thank you very much). As for real beginners, a basic knowledge of Python is a bit necessary and there are some great intros out there (start with: docs.python.org/tutorial/)...
Post a Comment