Django roundup: August 12

Posted by Clint Ecker on August 12, 2007

Django news:

Browsing through the repository checkins for trunk, I noticed that Malcom and Adrian had checked in over 50 patches for mostly bug-fixes to both code and documentation. If you’ve been waiting for a specific fix, take a look through the list. Thanks to everyone involved in working to get those 50+ patches integrated into trunk!

New Django sites of note:

Fredrik Lundh, maintainer of effbot.org, is currently porting over the "zone" (where things like PIL, Tkinter, and more are documented) to Django: “All in all, the zones at effbot.org currently contain around 2,000 documents, plus a couple of hundred user comments. Until now, the zone has been served as static HTML, generated and maintained using an increasinly disorganized collection of CGI scripts and off-site tools. Given that we moved pythonware.com to Django late last year, it’s about time I did the same to effbot.org.” Fredrik has written up his experiences during this process in a document which I highly recommend.

Code snippets and projects:

Maximillian Dornseif has posted a method for determining code-coverage of your Django project’s tests without having to alter any of the Django internals: “Siddharta Govindaraj has a blogpost on integrating Django with coverage.py to check what your tests actually test. Siddharta patches Django to archive his goals. But you can get the same results without fiddeling with Django’s Source-Code. Django now comes with a TEST_RUNNER setting which let’s you switch your testing engine.”

Ross Poulton has written a blog post detailing how to configure and use subdomains with your Django project: “As a part of my previously mentioned upcoming bridal gift registry project (which, by the way, performed outstandingly in it’s most important private beta ever – my own wedding) I’m giving each user (in this sense, a user is a couple close to getting married) their own subdomain off of the main website – instead of having a URL to their registry like http://yourdomain.com/registries/view/?id=1048 there are beautiful URL’s like http://couplesnames.yourdomain.com.”

Do you ever find yourself writing the same lines of code at the top of your views? Nathan Ostgard did and he’s such a dedicated DRY’er that he wrote a specialized middleware to clean up his code: “Having the same few lines at the top of every function in makes me feel dirty. You can clean this up with a Middleware class, replacing foo_id with the actual object before calling the view.” If you find yourself in the same situation as Nathan, head over to his blog, read his post, and hopefully make use of his middleware!