Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Template + Cache = Crazy Delicious
Here’s a simple class for a template tag that caches its output (with apologies to Chris Parnell and Andy Samberg): from django.core import template from django.core.cache import cache from django.conf.settings import DEBUG class CachedNode(template.Node): """ Cached template node. Subclasses should define the methods get_cache_key() and get_content() instead of the standard render() method. Subclasses may also define the class attribute cache_timeout to override the default cache timeout of ten minutes. """ cache_timeout = 600 def render(self, context): if DEBUG: return self. -
Guido reports: Django vs. Cheetah 1-0
Finally Guido got some time to play with goods. The verdict is in: Django vs. Cheeta 1-0.. -
Guido on web frameworks, again
If you liked reading Guido's previous post on Python web frameworks (Rails was mentioned too) and discussion that followed, you should read his second installment: Web Framework Redux. Don't forget to voice your opinion in the forum.. -
Django Dojo
Django-Dojo alliance was finally announced to the world by our very own Jacob Kaplan-Moss: Starting with version 0.92 (which should be out in a few weeks, Murphy willing), Django is going to bundle Dojo with the toolkit. Specifically as part of Django's admin interface (but available to user apps as well). Read all about it in Jacob's post. I am overjoyed to see such cool high quality open source projects are working together. Clearly it will make it easy to create kick-ass highly interactive web applications in Django and it will advance Dojo positions as a premier AJAX toolkit. It is a rare win-win situation for everybody involved including users of both frameworks. Some people, who fault Django on building its own components instead of reusing existing ones, will be surprised by this decision. Let me clarify that Django community is not affected by DIY and NIH syndromes. Being a part of it I can say that a lot of options are debated, and the most compelling alternative is used. This is the secret sauce, which makes Django so solid and consistent. Selection of Dojo is just a visible evidence of this approach. A lot of people are using Dojo … -
mobile.kusports.com
Over the past few days I’ve been spending some free time and downtime tweaking mobile.kusports.com and adding a couple of really cool (IMHO) features. We send out a ton of cel phone updates during each game, but I really wanted to bring our awesome live stats to mobile devices. The first order of business was to see how the low-tech live stats view looked on the mobile site. Since pretty much all of our templates extend a base template, it looked pretty darn good out of the box (thanks to template inheritance and some great default templates by Wilson and David). Most of the time spent on this template was to condense the stats a little bit to require less scrolling on small devices. Here is the live stats view using Opera Mini on my 6682: Having the live stats accessable from mobile devices is great, but it’s important to make it extremely easy for someone to get to them if they come to mobile.kusports.com while a game is in progress. The solution was to present the current score on the home page if and only if a game is in progress. This was accomplished by writing a custom template … -
Full Snakes & Rubies video is live
Finally full Snakes & Rubies video went live on Google Video! And it took only 18 days to verify it (19 days, if you count when I started to upload it). Apparently the whole process of verification depends on file size nonlinearly. It cannot depend on content because it is a combination of smaller files: Adrian's Django presentation, David's Rails presentation, and Q&A session. Oh, well. And now is time for some stats (1/9/2006–1/27/2006): Title Page views Downloads Snakes and Rubies (Adrian's Django presentation) 83 1 Snakes and Rubies (David's Rails presentation) 96 11 Snakes and Rubies (Q&A session) 36 1 Snakes and Rubies (full) 0 0 Totals 215 13 As you can see publishing files on Google Video was worth it. It helped ~200 people. Obviously nobody was able to see the full video yet because it just went live. One interesting tidbit: viewers loved to download David's presentation. Downloading Google Video file (.gvp) gives you a small text file, which references the web site and nothing more. You can save URL with the same effect. Of course some smart alecks can use tools to download actual video (.flv), but why? Much better original is available without restrictions and … -
Why you should use Django
Inspired by Guido van Rossum’s plea to be taught web frameworks here are (in no particular order) ten reasons why he — and you — should use Django. 1. Django works — right now Don’t be fooled by the fact that Django’s first release was in July. It’s been under heavy use for over two years, and I’m confident saying it has no show-stopping bugs. I’m tired of hearing that that SomeAwesomeFramework™ will be “great when it’s finished”. -
Building a Blog with Django
NOTE The Python code in this tutorial no longer works with Django! Please read my new article, a Django Blog Redux, for code that works on newer versions of Django. The rest of this article, such as the theory, is still very much applicable and should be read alongside my newer code. When I first posted about Django, I said that I'd post the details of how I wrote a blog in Django, without actually writing any real Python code. This will show you how you too can have a simple blog working in no time at all. I'll assume for this article that you've got Django installed and working, and you know the basics. Create a new project and within it create a 'blog' application. Edit the models file for that application, so it contains the following text: from django.core import meta class Tag(meta.Model): slug = meta.SlugField( 'Slug', prepopulate_from=("title",), help_text='Automatically built from the title.', primary_key='True' ) title = meta.CharField('Title', maxlength=30) description = meta.TextField( 'Description', help_text='Short summary of this tag' ) def __repr__(self): return self.title def get_absolute_url(self): return "/tag/%s/" % self.slug class META: admin = meta.Admin( list_display = ('slug', 'title',), search_fields = ('title', 'description',), ) class Post(meta.Model): slug = meta.SlugField( … -
Building a Blog with Django
NOTE The Python code in this tutorial no longer works with Django! Please read my new article, a Django Blog Redux, for code that works on newer versions of Django. The rest of this article, such as the theory, is still very much applicable and should be read alongside my … -
Strike averted
I’m thrilled to announce we’ve hired James Bennett (a.k.a ubernostrum in #django) as World Online’s new front end developer. About a month ago he wrote: I’m desperately looking for someone to pay me to build something with Django, and if it doesn’t happen soon I’m just going to go on strike. Whew — strike averted. Seriously, though we’re extremely excited to have James joining our team, and we can’t wait to see the cool shit he’s going to build here. -
Django - My First Impressions
Until last week I had never heard of Django, a web framework written in Python. I'd seen python before, but had never really tried it out - I could do everything I wanted to do in PHP, and having libraries such as Smarty available to me solved all my problems. Or so I thought. I thought I'd give Django a shot as I'd seen it touted as the Ruby on Rails killer in Python. I downloaded it, installed it on UGBox, enabled mod_python and walked myself through the Django tutorial. Not 15 minutes later I had a working application, but I'd written bugger all code. This inspired me. Django has a publishing background - it was originally written for use by a number of newspapers and websites in Lawrence, Kansas. I've been working on a website for a little while now (which is still not live - it'll be ready soon, and is aimed at Blokes in Australia) which follows a similar publishing model - articles, authors, categories, comments... pretty straightforward stuff. I got to work writing a simple data model in Django during my lunchbreak last Friday. In one file I set out some basic details for my database … -
Django - My First Impressions
Until last week I had never heard of Django, a web framework written in Python. I'd seen python before, but had never really tried it out - I could do everything I wanted to do in PHP, and having libraries such as Smarty available to me solved all my problems. Or … -
Getting Started With Django
I've just written this quick weblog app using Django - a new(ish) web framework written in Python. So far it seems pretty damn good - I've also written an article management system for a new website I'm starting, and it only took a lunchbreak to get going. Amazing. I'll post some more detail up soon. -
Getting Started With Django
I've just written this quick weblog app using Django - a new(ish) web framework written in Python. So far it seems pretty damn good - I've also written an article management system for a new website I'm starting, and it only took a lunchbreak to get going. Amazing. I'll post some … -
Done
Yes, the Snakes and Rubies videos are now online. No, they’re not perfect. No, I’m not going to wait for FCP to re-render any more. I’ll write a post-mortem after I’ve gotten some sleep; now go watch Adrian kick major ass. -
Live Filtering
Update on 11/25/2007: today this article presents mostly historical interest. Since Dojo 0.2 a lot of versions were published and many things were changed. At the time of this writing Dojo is at ripe 1.0. I had to disable all Ajax action in examples because I don't use Dojo 0.2 anymore. What is Filtering? It is a selection of items using some criteria (filter). In this tutorial I am going to filter documents of my blog (made with Django, of course) matching titles against user-specified substring. Later on I'll talk about generalization of this approach. Just like a big boy I am going to use Custom Manipulators, which can be avoided, but I want to show how to use it. We all want to improve end user's experience. To improve usability I'll put a little "live" in it using Ajax (courtesy of Dojo) later on. You can see for yourself how simple it is. Filtering Django's ORM provides several ways to do a substring search: contains, icontains, startswith, istartswith, endswith, iendswith. Which one should we use? Let's do all of them. I am going to create a separate function, which will take user's input as parameters and returns a string … -
Dojo gets a manual
Since my last post hit the Dojo folks pretty hard for the lack of documenation, I’d be remiss if I didn’t point out that they now have a manual online. It’s far from complete at this point, but it covers most of the basics and it’s been really enjoyable to read through. I’d certainly say that huzzahs are in order. -
Django, meet Dojo
After hearing some rave reviews of Dojo on django-dev, I finally got around to checking it out today. Here are my thoughts (with an obvious focus towards) using Dojo with Django). The good Dojo is extremely powerful. With very little code I was able to make a really nice drag-and-drop reorderable table, complete with nice zebra striping and add/remove row buttons. (Wilson and I are working on a new kick-ass interface for Django’s “edit_inline” admin views, if anyone cares. -
Have more…
Have more than thou showest, Speak less than thou knowest, Lend less than thou owest, Ride more than thou goest. — King Lear 1.4.71-4 -
Django performance tips
Django handles lots of traffic with ease; Django sites have survived slashdottings, farkings, and more. Here are some notes on how we tweak our servers to get that type of high performance. Use a separate media server Django deliberately doesn’t serve media for you, and it’s designed that way to save you from yourself. If you try to serve media from the same Apache instance that’s serving Django, you’re going to absolutely kill performance. -
Snakes, rubies, and some comments
A week ago I posted a link to David's take on "Snakes and Rubies" event. Of course I am talking about article written by RoR's creator. It is a great read, but this time I've read reader's comments (or "challenges to the Loud Thinking"). Oh, boy! It gives you insight into Rails, Django, and their perception by developers and users. For example, I am not very familiar with i18n problem, but it looks like a lot of people were quite passionate about it. In general it gave me a different prospective on problems of fellow DreamHost customer Alex Payne (outlined here). When I was setting up some of my stuff on DreamHost using Django I had to figure out some things: proper FastCGI setup, .htaccess incantations, and so on. I was kind of envious of RoR's users because "Ruby on Rails now fully supported complete with FastCGI!" (taken from What's New marquee section of DreamHost's main page). I assumed DreamHost had these problems solved. It did. I didn't know at that time that there are some other problems mentioned by Alex. Django is rock solid, I never had problems with stability, memory leaks, and so on. My blog is up … -
Django Ajax Redux
Three weeks ago we had a discussion about Ajax support in Django, which resulted in "Ajax and Django" wiki page. A short recap: it lists a vague goal, some general considerations, and possible strategies; it scratches the surface of existing implementations (mostly RoR), existing third-party toolkits (Mochikit/Dojo), and related RPC-style and REST-style services. No code was produced, no consensus was reached, but now it is a part of Django's Version One roadmap. Now three weeks later I assume that everybody had time to think about it. I want to move the whole discussion on to a more practical plane. Basically I want to propose an implementation. At least I’ll collect your thoughts, criticism, corrections, and, hopefully, blessings. Giving the speculative nature of this proposal, which is based solely on my experience, I decided against posting it in the wiki in its present form. The size of this proposal is not conductive to mail list posting. Hence it is here. Saddle up. Rationale I am a conservative pragmatic, who values the art of possible — don’t expect any outrages proposals. And like many programmers I am quite lazy — don’t expect glorious efforts required to implement my proposal. What I want … -
Hiring, part II
Want to work for the most innovative news organization in the country, if not the world? Want to join a team of the best and brightest online media developers? Want to get paid to create award-winning web sites? Well, have I got the job for you: World Online is looking for a kick-ass front-end web developer. Update This position has been filled; thanks to everyone who applied. We’re still hiring a back-end web programmer, though. -
We're hiring!
Want to work for the most innovative news organization in the country, if not the world? Want to join a team of the best and brightest online media developers? Want to get paid to create award-winning web sites? Well, have I got the job for you: World Online is looking for a kick-ass web developer to join our team. About the job Unofficially, the job description is “build cool shit.” Our goals are nothing short of being the coolest and most innovative web team in the world. -
Lightpd on Ubuntu
Ubuntu “Breezy” doesn’t have lighttpd (yet), and the only Ubuntu binaries I could find were (a) stale and (b) compiled for x86. Building lighty from source with the standard configure; make; make install dance works fine, but it forgoes APT… and why would you use Ubuntu if you wanted to avoid APT? So, here’s how to build lighty from source into a Ubuntu package so it’s all nicely wrapped up and maintained for you.