Django community: Community blog posts RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
JOINs for NoSQL databases via django-dbindexer - First steps
At the moment, we have a lot to do in terms of finishing our diploma thesis. However we're so excited about the early results of the currently refactored django-dbindexer that we couldn't hold back and keep django-dbindexer's simple JOIN support for non-relational databases a secret anymore. Yes, you didn't read wrongly, this post is about JOIN support for NoSQL databases! We'll show how to use in-memory JOINs and how to get JOINs working if the joined field's value doesn't change. So let's unpack our delayed Christmas present. ;) Let's rock! Let's take the example of a photo-user relationship, just like in our post JOINs via denormalization for NoSQL coders, Part 1: # photo/models.py: from django.contrib.auth.models import User from django.db import models class Photo(models.Model): owner = models.ForeignKey(User, null=True, blank=True) popularity = models.IntegerField(choices=[(0, 'low'), (1, 'medium'), (2, 'high')], default=0) published = models.DateField(auto_now_add=True) title = models.CharField(max_length=500) Here, each photo entity is linked to a user via a many-to-one relationship and has a popularity tag assigned to it. Additionally we store the date when the photo has been published and give the photo a title. Now let's say you want to get all of a user's photos. In order to do so, NoSQL databases … -
Giving Back to the Community
We're big fans of open source, so we like to give back to the community whenever we can. Having a strong community is actually personally and professionally selfish: a vibrant community not only helps ensure we keep getting to eat on a regular basis, but it also means there is more useful code available for us to use. Neither Jacob nor myself would be in the position we're in if it wasn't for the open source community. So even though we're a small company, in 2011 we're trying to really step up the ways we give back to the community. Office Hours We'll be holding another one of our IRC "office hours" in #revsys on Freenode this coming Friday, February 4th, from 3-5pm Central. We held our first a few months ago and it was not only successful, but fun so we're doing it again. We hope to have enough time to do this at least a few times a year. Sponsoring PyCon Where would we be without Python? Sure we could have spent this money on a new hot tub for the office, or perhaps adding another runway to the RevSys HQ airstrip, but we figured helping PyCon be … -
ReCaptcha in Django Forms
Using ReCaptcha widgets in forms managed by Django -
What I want for Django Facebook connect
For a customer I need to do Facebook authentication on a new Django project. I went to the Django Packages Facebook Authentication Grid and figured I would plug it in, set some keys, and go! Facebook authentication is a common client requirement, and this must have been solved many times over, right?Unfortunately, most (I'm still going through them) of the listed packages worry me. Security is HARD. Security is DANGEROUS. Since Facebook auth is a common requirement I shouldn't be forced to roll my own authentication or hack through someone else's implementation to get things working.Yet many of the packages listed in the grid above lack documentation or what exists is outdated. Some of them simply drop errors or seem to intentionally obfuscate them (I won't name anyone YET because I want to give people a chance to correct these issues). Finally, I've yet to find any with any sort of logging to help diagnose possible intrusions or just as a way to see what is happening when you have trouble hooking up things.I understand that Facebook is a moving target. But on the other hand, shouldn't updates to these things be in place?So what do I want in a … -
Roadmap to 2.2
Roadmap to 2.2 -
Post on Request
In the last few weeks I have been little busy(and suffering from lack of inspiration) so my blog lacks of new posts but I see that there are people visiting it(especially for the Django CMS stuff) so I am willing to start a “Post on Request” practice. The idea is simple – I will collect [...] -
A (Complete) Guide to Running Django on Joyent Shared Accelerators using Virtualenv, pip, git, and NginX
A (Complete) Guide to Running Django on Joyent Shared Accelerators using Virtualenv, pip, git, and NginX -
FOSDEM 2011 and GNOME Foundation
That’s right, once again I could count on Igalia‘s kind support to be able to go to this great conference one more year. Just like last year, I’m giving two presentations: * Making the printed world accessible: A11y in OCRFeeder, in the Accessibility DevRoom on Saturday at 11:00; * Grilo: Integration of Multimedia Contents in [...] -
FOSDEM 2011 and GNOME Foundation
That’s right, once again I could count on Igalia‘s kind support to be able to go to this great conference one more year. Just like last year, I’m giving two presentations: * Making the printed world accessible: A11y in OCRFeeder, in the Accessibility DevRoom on Saturday at 11:00; * Grilo: Integration of Multimedia Contents in Applications Made Easy, in the CrossDesktop DevRoom on Sunday at 13:45. This will be my fourth time attending FOSDEM and every year I love it more. In what other conference can you attend presentations about: GNOME, MeeGo, Django, Accessibility and much, much more. And let’s not forget about the Friday Beer Event, that allow us hackers to socialize while sipping on the finest beers on earth. And of course, to some of you, I don’t need to tell again how much I like Brussels, and Belgium in general. By the way, this year there is a new, more Maemo-ish, FOSDEM Maemo app called Sojourner which will help you schedule the talks you wanna attend, so, be sure to install it in your N900. (I’ve contributed with a couple of patches last Friday, which are pending integration ) Other news from my part is that since … -
Jimmy Page: site-wide Django page caching made simple
For some time, I've been using the per-site cache feature that comes included with Django. This site's caching needs are very modest: small personal site, updated infrequently, with two simple blog-like sections and a handful of static pages. Plus, it runs fast enough even without any caching. A simple "brute force" solution like Django's per-site cache is more than adequate. However, I grew tired of the fact that whenever I published new content, nothing was invalidated in the cache. I began to develop a routine of first writing and publishing the content in the Django admin, and then SSHing in to my box and restarting memcached. Not a good regime! But then again, I also couldn't bring myself to make the effort of writing custom invalidation routines for my cached pages. Considering my modest needs, it just wasn't worth it. What I needed was a solution that takes the same "brute force" page caching approach that Django's per-site cache already provided for me, but that also includes a similarly "brute force" approach to invalidation. Enter Jimmy Page. -
Actualitzant coses
Aquesta setmana he estat força entretingut, m'he estat mirant un grapat de llibreries i utilitats, algunes d'elles noves versions que han anat evolucionant i millorant al llarg del temps. També vaig tenir l'oportunitat d'assistir a la xerrada de Maria Antònia Mas Pichaco damunt la guia PMBOK®, gràcies a l'empenta de Paco que em va recordar que es donava la xerrada. A part de la conferència en sí, també va estar molt bé el cafetó i la xerrada amb Paco, això de contar batalletes i compartir opinions no s'ha de perdre Paco! :) Xerrada de PMBOK® Si anam per ordre el primer seria parlar de la xerrada de Maria Antònia. A diferència d'altres assistents que l'havien tinguda com a professora, era la primera vegada que l'escoltava. Em va agradar, la exposició va ser clara i entretinguda. M'hauré de llegir la guia per poder-ne fer una avaluació en profunditat, però pel que vaig entendre es tracta d'un conjunt de recomanacions i millors pràctiques que cobreixen el cicle de la gestió de projectes, però que en cap cas ens marca un camí a seguir o una metodologia. Supòs que la utilitat vindrà quan ja hagis elegit com gestionar un projecte. En la part … -
Django Template Debugging Made Easier with django-template-repl
When working with the Django template language, specifically writing template tags or trying out new template tags that are not well documented, it's easy to fall into a testing loop that involves modifying your code, saving the file, causing runserver to restart, which could take some time for large projects, switching to your web browser, hitting reload, and viewing the results. This workflow can be repetitive and unproductive. I decided to improve template interpreter interactivity by writing a REPL for it, and I released the project as django-template-repl, which is freely available on Github and PyPI. I was surprised and happy to see it was well accepted judging from the twitter chatter and github statistics, so I wrote this to better explain how to use it.One of the greatest advantages of Python, Lisp, and other programming languages is the ease of debugging and understanding code behavior provided by REPLs. A REPL, which stands for Read-Eval-Print Loop, is a shell that gives you an interactive command line session with your language interpreter. The two REPLs most Django users should be familiar with are ipython and (i)pdb. These tools are incredibly helpful and really boost the usability of Python. I spend more … -
Introduction to Surlex Slides from Djangocon 2009
I have uploaded my slides from my lightning talk on Surlex at Djangocon 2009.I have uploaded my slides from my lightning talk on Surlex at Djangocon 2009. Here is the link: http://media.codysoyland.com/pdf/surlex-presentation.pdf. -
Introduction to Surlex
Surlex (Simple URL Expression) is a language for matching and extracting text, similar to regex (regular expression). It works by generating a regular expression from a more concise syntax that is designed to produce easy-to-read url patterns.Installation Surlex is indexed in PyPI, so it can be installed via pip or easy_install: pip install surlex Alternatively, the source code repository is available via git: git clone git://github.com/codysoyland/surlex.git Basic Capturing A capture is performed by enclosing a variable name inside angle brackets: <name> This is equivalent to the following regex: (?P<name>.+) A usage example for matching a blog index view is: /blog/<year>/ This is equivalent to the following regex: /blog/(?P<year>.+)/ This surlex would match the following URLs: /blog/2008/ /blog/2009/ To invoke the capture in our source code we can use the Surlex class or the match function: from surlex import Surlex, match surlex = Surlex('/blog/<year>/') # returns surlex object surlex.match('/blog/2009/') # returns {u'year': '2009'} match('/blog/<year>/', '/blog/2009/') # returns {u'year': '2009'} match('/blog/<year>/<month>/', '/blog/2009/09/') # returns {u'year': '2009', u'month': '09'} Advanced Capturing with Embedded Regex Surlex allows you to insert custom regex strings inside your surlex by postfixing the capture name with the equals sign (=) followed by a regular expression: from surlex import … -
Django Template Tag Namespaces Now Possible
I've been interested in the Django template language for some time now, and I've admired much of its simplicity and extendibility. I even wrote a shell for it (screencast) and a two-phase template renderer. Having spent the time to understand how it works, I've also had my share of ideas on how to improve it (addition of "elif", mathematical operations in variable tags, namespaces). The pony that I've been wanting the most is probably namespaces. There has been talk of adding namespaces to Django templates for quite a while (including a ticket with patches and some various discussions on the mailing list (1, 2 and 3)). For years, this concept has sat dormant due to lack of discussion and interest. No pluggable solution had been offered (as far as I know), so I wrote a couple of templatetags that offer namespacing and other features while retaining backwards compatibility and not requiring a fork of Django. This code is available on Github as django-smart-load-tag.Backwards compatibility Django's policy is to remain backwards compatible, and the template language is certainly no exception. In order to give the "{% load %}" tag namespacing features, it needed to be extended in a way that allows … -
Thread-Safe Object-Oriented Views in Django
An emerging design pattern in Django is the usage of class-based views. Writing views as classes is made possible by Python features that allow classes and objects to behave as callables, just like functions. They can help organize view code and promote reusability by offering a greater level of customization. However, callable objects sometimes have thread safety issues that developers are often not aware of. Update 2/2/11: This post is now mostly irrelevant, because Django will soon solve this problem with the newly-refactored generic view module in Django 1.3, which is due for release this month. Since I wrote this post a year ago, massive arguments over the design of class-based views erupted on the mailing list. It definitely got out of hand, but a lot was learned, and I'm happy with the solution that was committed. I still encourage people to understand how to avoid threading side-effects. I would also suggest reading the new documentation on class-based generic views. The most common approach to class-based views is to create a callable object, a class that has been written with a __call__ method, therefore making instances of the class callable. The view is instantiated either as a module-level variable in … -
Evaluating Django Caching Options
Caching is one of the first things you can do when you need to start thinking about scaling. Among efforts such as query minimization, denormalization, code optimizations, compression, database tuning, indexing, and load balancing, caching remains one of the lowest hanging fruits in methods to lighten your server load and handle huge amounts of traffic. There are many options, and I chose to evaluate a few of the most interesting setups.This is not intended to be a rigoriously scientific test, but more of a first impression of the different caching systems. For all the tests I'm describing, I'm using a single VPS on Rackspace Cloud with 320MB of RAM, a quad-core AMD Opteron 2350HE, and a bleeding edge server stack using Ubuntu Server 9.10, NGINX with UWSGI, Python 2.6, Django 1.1, and PostgreSQL 8.4. I'm serving the home page view of Django-Mingus, which provides a realistic amount of complexity to the Python side of things and gives us a 9387 byte response. I'm using 4 UWSGI processes and a single NGINX worker. All my tests are using ApacheBench, which I'm running on the same machine. Note that for all my cache tests I'm prepopulating the cache before running the benchmark. … -
Screencast - django-template-repl
Django-template-repl is a unique project aimed at providing debugging tools for the Django template language. I did a screencast to highlight its features.In this video, I describe how to use Django-template-repl's management shell, template tag, and context-capturing features. Please grab the source or simply run: pip install django-template-repl -
Django 1.1 Testing and Debugging Book Review
A review of Django 1.1 Testing and Debugging by Karen M. Tracey, published by Packt Publishing. -
Custom Filters in the Django Admin
Adding custom data filters to the Django admin interface -
Gondola for Real Estate Launch
I’m pleased to announce that Gondola for Real Estate”, our GeoDjango-backed real estate CMS is publicly accepting new customers. A couple weeks ago, we quietly re-launched gondolacms.com with some details about the platform and what it has to offer, as well as some sites that have been built on it over the last few months. -
Easy Fabric Deployment, Part 2: Multiple Committers and the Dreaded Umask
In part 1, we showed how we use Fabric to update and deploy Django sites to our development server with a single command. This works great when you only have one developer pushing changes to the server, but what happens when multiple committers need to update the development server? -
Django 1.0 Template Development Book Review
Packt Publishing was nice enough to send us a copy of Django 1.0 Template Development by Scott Newman for review recently. I get most of my technical information via the web, so picking up a technical book was a nice change of pace. This is a well written and enjoyable read for people looking to learn a little more about Django than what is provided in the Django tutorial. -
Tracking Application Response Time with Nginx
Using Nginx to track response times for multiple Django sites served via Apache/mod_wsgi -
Lincoln Loop Development Sprints and Limited Time Discount
Today, we are launching a new offering at Lincoln Loop, development services paid by the sprint. Previously, our typical engagements involved a (sometimes lengthy) discovery, estimation, and bidding process. Lately, however, people have been asking us to jump in with both feet and help them get started immediately. For those people, we think paying for services on a sprint-by-sprint basis will be a great option. As part of our initial promotion for the service, we’re discounting the price 30% for a limited time.