All posts tagged ‘django’

File Under: Frameworks, Programming

Use URL Patterns and Views in Django

Last time around, we installed Django and started building a blog application. We got Django’s built-in admin system up and running and explored some third-party libraries like the django-tagging project.

So far we have some cool administrative tools, but no website for the rest of the world to see. This time around, we’ll work on displaying our content to the world by building the URL patterns and constructing some “views” — a term with a very specific meaning within the Django framework.

Everything we’re going to do will make more sense if you understand how Django processes your visitor’s request. We went over some of this in our introduction, but here’s a quick refresher course.

Continue Reading “Use URL Patterns and Views in Django” »
File Under: Databases, Frameworks

Django 1.2 Alpha Offers Multiple Database Support, Improved Security Features

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.

See Also:

File Under: Location, Social, Web Apps

User-Contributed Announcements Give EveryBlock a Human Touch

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.

See Also:

File Under: Software & Tools

Django Unveils 1.1 Roadmap

django folderAs announced at the recent Django Conference, the web development for “perfectionists with deadlines,” is moving to a regular, timed release schedule. The full details of how Django releases and version numbers will work can be found in the project’s much improved documentation, but the real news is that Django 1.1 will arrive in March 2009.

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.

See Also:

File Under: Programming

Simplify Django Debugging With New Toolbar

Django toolbar in action

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.

The inspiration came from the Symfony Project, a PHP framework. Hudson announced his project after Cal Henderson showed something similar for Pownce at DjangoCon during Henderson’s Why I Hate Django talk. Later, Hudson collaborated with fellow developer David Cramer, so the toolbar grew out of the Django community.

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.

[Screenshot by David Cramer]

See also: