This is part 4 of Webmonkey’s introductory Django tutorial. If you’re arriving here to learn about getting started with Django, start back at the beginning with Lesson 1.
When we left off last time, we had defined some URLs for our blog and constructed a custom view to handle displaying posts by tag. If you point your browser to our development URL at this point, (http://127.0.0.1:8000/blog/) you’ll still see a Django error page complaining that the template blog/list.html does not exist. Don’t panic, it’s true — we haven’t created it yet.
It’s time to tackle the last aspect of Django, the template syntax.
Django, the popular web development framework written in Python, has released the first alpha for its much-anticipated new version, Django 1.2.
Among the new features coming in Django 1.2 are support for multiple databases — a key feature for larger websites running Django — improved security features and a messaging framework that works much like Ruby on Rail’s “flash” feature.
The multiple database support will likely be the most important part of the next version of Django since it will allow for much easier application scaling. Django 1.2 makes it easy to target individual databases within your apps using some new queryset methods which make it easy to read and write to specific databases.
The security features include much-improved protection against Cross-Site Request Forgery (CSRF) attacks. For more details on how the CSRF protection works, have a look at the new CSRF documentation page.
If you’d like to test out Django 1.2, or see how your apps run on the new release, head over to the downloads page or update your Subversion checkout. Keep in mind though that this is still an alpha release and should not be used on production sites. The final release of Django 1.2 is scheduled to arrive in March 2010.
EveryBlock, the local news aggregator that shows you block-level details about your city, has added a new feature dubbed, “Notify your neighbors,” which allows anyone in your neighborhood to post news on the site.
EveryBlock, which launched in 2008, touts itself as “a geographic filter” for your city or your neighborhood. The site crawls local newspapers, radio and television stations as well as local blogs, independent media sources and government data feeds to show you what’s happening on your block. At the moment EveryBlock serves fifteen U.S. cities, though the site is always taking suggestions for more.
While EveryBlock pulls in an impressive amount of data, it can’t hope to find everything about your block — for example, a private neighborhood listserv or other very small, self-organized neighborhood websites are either off limits or simply too numerous to crawl.
The new Notify feature is, in part, designed to overcome that by allowing you to post your own events, news and, well, anything really.
The EveryBlock blog calls the new feature “intentionally open-ended,” and is hoping that users will come up with novel ways to use it. Early beta previews were made available to select users who used Notify to do everything from post lost pet messages to chatting about howling cats and missing mailboxes (damn kids!).
The new feature is also part of the EveryBlock iPhone app, so you can post announcements as you walk down the street.
Within the site, user-generated posts are labeled as “announcements” and link back to the poster’s profile (so yes, you need to sign up before you can post).
So far the feature looks very useful and gives EveryBlock a human touch that sometimes felt missing in early incarnations. Whether or not it will help build a community or end up being overrun with spam remains to be seen.
That means that if there’s something you’d like to see in Django 1.1, you need to make your proposal before November 7. Come November 15, we’ll get to see what the Django team will be working on for the next release.
Look for django 1.1 at arrive somewhere around March 16-20.
As outlined in the docs, all minor Django release (1.1, 1.2, etc) should be backwards compatible with earlier 1.x releases, so if you’re writing code for Django 1.0 you should be fine when the next minor version arrives.
Django developer Rob Hudson has built an extensible Django Debug Toolbar for viewing common information, such as HTTP headers and SQL queries. When installed and enabled, the toolbar takes up less than thirty pixels at the top of the screen. You can click one of the panels (there are currently seven available) and an overlay opens for that panel.
One of the coolest things about the project is that each panel is separate. So, if you don’t want the one that shows the current version, you don’t have to include it. Even better, if it’s missing functionality you want, or there’s something specific to your project you want to show in the debug toolbar, you can write your own panel.
Unlike many of the toolbars we see, this one is not installed in the browser. It resides on the same server as your Django installation. It’s meant for developers, not end-users, so it only shows when it matches the IP addresses added to the INTERNAL_IPS Django setting.