Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Create a Stand-alone Django Documentation Browser
I’m constantly quitting and changing browsers. I got tired of having to load up the Django Documentation. I found an easy way to keep up the Django docs by themselves. I use Fluid, a site-specific browser creator, for Google Reader, and I thought why not for this? When you launch Fluid, It asks you for a URL, a Name for the application, a location to save the application and what icon to use (it defaults to the web site’s favicon). I created my own PNG and made it the icon. Once you press the Create button, you can open the application by double clicking on it. To make the application a bit more flexible, open the preferences (command-,) and click on the Advanced icon. There you can add and change the urls that this application will go to. I changed the url to *.djangoproject.com/*. There you have it: a stand-alone browser of the Django documentation. -
7. Finishing the Weblog
This is part 7 of a series of posts on James Bennett's excellent Practical Django Projects. The table of contents and explanation can be found here Firstly, the comments framework has been re-written for 1.0. The documentation for it can be found here if you need to refer to it. That out of the way lets get into the meat of the chapter. There is now only one model for comments instead of two -
Field/column Queries in Django
Field/column Queries in Django -
My Django development environment
IDE After using a few other IDE‘s I settled down with Eclipse with Aptana plug-in as the IDE I use for peach³ development. This one environment has support for everything I need while developing a Django application: Python, HTML and JavaScript support is great, with code completion, including completion for the Ext.js javascript library. And I even have the idea that I’m not using the full power of Eclipse yet. By default, Eclipse and Aptana have no Python support, but it can be integrated with PyDev. The only thing missing to make it the best environment (in my opinion) is support for Django template tags: a Django template tag inside a HTML or JavaScript file usually results in an inline error message. But you can just ignore these error messages. For some of the most used Django management commands (runserver and test) I’ve defined ‘tools’ in the Eclipse interface and I can now start my development server or run the testsuite with a single click inside Eclipse. Here is how I set up the single-click runserver tool: In “Run > External Tools > External Tools…” I’ve added a new tool called “Django Runserver” and I set up the following on … -
ORD Camp a Huge Success
I was luck enough to be invited to attend ORD Camp this last weekend in blisteringly cold Chicago.  ORD Camp is an invite only, FooCamp style unconference targeted at geeks living in the Midwest. Having never attended a FooCamp style event I wasn't sure what to expect.  I can now say if you ever have the opportunity to attend an event like this it is well worth your time. As you can see from the attendee list it was a very diverse group of people, not just the usual crowd of notable Open Source geeks.  The amount of brain power in that room was simply amazing and I can't remember when I had as much fun.  Some sessions were presentations, others were just focused discussions.  Everything from how words work, brewing beer, life hacking, to what not to do as a startup.  While I loved the sessions the most fun was getting into random conversations ( some ended up being NSFW after midnight and many beers ) others were more typical.  Spent some time talking with people about PostgreSQL's advantages over MySQL, alternative business models, how a certain entrepreneur might improve the performance of their servers, etc. It is difficult … -
Running long processes in Django
My original issue was that I had this piece of code in my Django project that was taking way too long to run, sometimes even leading to a load time out. The particular situation happens very infrequently (at most once a week), so it was just a matter of getting the process to run successfully. Along the way, though, I learned a lot about spawning processes, distributed computing, and the different options we have in the Python community. The different approaches are just ways to get the processing to be done outside the Django process, of course. cron and queue cron I will first start with the recommended process of taking care of this issue. You can setup a cron job to run some code that checks every minute to see if there’s anything to process and then run the appropriate code. Cron jobs are pretty simple to setup and pretty effective. All you need to do is edit the crontab with the time intervals you want the service to be run and your code takes care of the rest. django-queue-service The cron part of this solution takes care of when the processing happens, but what handles why it happens? … -
Pinax update: breaks external dependencies
Have you been working off the Pinax trunk only to be surprised by the following message after an update: Error: No module named notification Basically what happened is summarized on the django-hotclub page, which I apparently should start paying closer attention to: http://code.google.com/p/django-hotclub/wiki/MovingToDistutils What this all means is that you will need to change your setup a bit to get Pinax to work in its new setup… What I had to do first was install pip and virtualenv sudo easy_install pip sudo easy_install virtualenv If you need to setup easy_install or you have any trouble with the following step, try updating python-setuptools sudo apt-get install python-setuptools You will also need to install git and bzr as mentioned in the wiki page. On my Ubuntu box, it was simple as installing git-core and bzr sudo apt-get install git-core sudo apt-get install bzr After that you need to run the following command to download the apps (Feb 6, typo fixed, thanks Vernon): sudo pip install -r pinax/requirements/external_apps.txt And then back to your normal: python manage.py syncdb python manage.py runserver (of course this is just on your dev box…) hope that helps. -
The taste of shame and humiliation
What a way to start the morning: Yup, that’s right; my former employer the Lawrence Journal-World – one of the most ground-breaking, award-winning, forward-looking, innovative news organizations in the world – is now serving pop-under ads. I really did think that my former bosses, friends, and colleagues there knew better. I can only hope this was a top-down do-it-or-lose-your-job edict, but even that smacks of the kind of dictatorial micromanagement I thought the company was above. -
Django Site of the Week - Deskography
Seeing how other people work is something that seems to be of interest to most developers. Whether it's because they want to become better workers themselves or because they're somewhat voyeuristic is open to debate - either way, Django-powered website Deskography is a well-designed social desk-sharing website. This week, I spoke to Gustaf Sjöberg of Distrop to find out why they chose Django to power Deskography, and what it's allowed them to do. You can read the interview over at the Django Site of the Week. -
Django Site of the Week - Deskography
Seeing how other people work is something that seems to be of interest to most developers. Whether it's because they want to become better workers themselves or because they're somewhat voyeuristic is open to debate - either way, Django-powered website Deskography is a well-designed social desk-sharing website. This week, I spoke … -
MEDIA_URL and context from processors available in HTTP 500 template
It’s easy to create a custom template for HTTP 500 errors. All you have to do is create a file named 500.html in any of the application’s TEMPLATE_DIRS. But in almost all cases you want to use media in this page. It’s good to have an error page with the same look and feel of [...] -
Better spam defense for Django comments
I've finally found the time to package up an improved version of my comment validation. In addition to the original's simple link count, this version checks if the commenter's IP has been banned or has submitted questionable (non-public) comments in the past, and compares the comment to a series of phrase blacklists. It also includes batch tools in the comments administration pages, to reduce the time you spend banning IPs or deleting spam. -
Enable distutils for a django reusable app
As you might already be aware Pinax move to distutils, this change has been described by James Tauber in this post. Today I have decided to make my feet wet with this approach for a django reusable app. I have been guided by jezdez on #pinax.Before starting I would recommend you to read this page, yes I know, it is a bit long but very interesting. after this reading you will be well prepared to start to work on you django reusable app.I have used one of my project django-geotagging to experiment with this approach. The project can be found on launchpad there. The good news about this approach is that all the major rcs are supported : SVN, BZR, HG, ... If your favorite versionning system is missing there is a good chance that I just forget to mention it. This list is not exhaustive.The core of this approach is a file called setup.py that need to be paced at the root of your repository, most of its argument are self explanatory.This file enable you to setup a complete env in 4 steps :Create a virtual env : virtualenv geotagging_env Move into that env : cd geotagging_env Activate the … -
To FogBugz With Python
A couple of weeks ago, I announced the pyfogbugz project that will, when complete, serve as a python wrapper around the FogBugz API. I have had very little time to spend on it recently so it has not progressed much at all. However, one feature that I have added recently is the ability to use the simple BugzScout interface for submitting bug reports. The one feature about this interface that solves an immediate problem for me is being able to deal with duplicate exception reports. One of my major annoyances with picking up exception reports from an email inbox that FogBugz creates tickets from is that it can't deal with duplicates, so I end up spending a lot of time gardening tickets that are duplicates of each other. BugzScout will solve this problem by automatically appending to a ticket that has an identical title. I find this extremely useful. While the library is not comlete, the BugzScout part of it is usable. To install and use: git clone git://github.com/paltman/pyfogbugz.git cd pyfogbugz pylink pyfogbugz ## See link [1] to Eric Florenzano's post Now in your python script: from pyfogbuz.scout import post_report post_report('title of the report', 'body of the report -- what … -
To FogBugz With Python
A couple of weeks ago, I announced the pyfogbugz project that will, when complete, serve as a python wrapper around the FogBugz API. I have had very little time to spend on it recently so it has not progressed much at all. However, one feature that I have added recently is the ability to use the simple BugzScout interface for submitting bug reports. The one feature about this interface that solves an immediate problem for me is being able to deal with duplicate exception reports. One of my major annoyances with picking up exception reports from an email inbox that FogBugz creates tickets from is that it can't deal with duplicates, so I end up spending a lot of time gardening tickets that are duplicates of each other. BugzScout will solve this problem by automatically appending to a ticket that has an identical title. I find this extremely useful. While the library is not comlete, the BugzScout part of it is usable. To install and use: git clone git://github.com/paltman/pyfogbugz.git cd pyfogbugz pylink pyfogbugz ## See link [1] to Eric Florenzano's post Now in your python script: from pyfogbuz.scout import post_report post_report('title of the report', 'body of the report -- what … -
Django ORM now supports fields references in filters
Today was added a new feature to django ORM. Now it supports references to fields in filters expressions. Just checkout the SVN version and enjoy it. Before this update, queryset could be filtered only by absolute values. queryset.filter(field='absolute value') Will generate somthing like this: SELECT * FROM table_name WHERE field = 'absolute value'; Now you [...] -
Full-text searching in Django with PostgreSQL and tsearch2
Recently, I have wanted to improve the searching ability in a number of my projects. I've often added a search box that simply does an icontains filter, which works fine for small sites but doesn't scale due to the inefficiency of matching text with basic SQL queries. The plus side of an icontains filter is that it works on all of Django's database backends (with the exception of SQLite, which works but in a case-sensitive way). All of my projects run on PostgreSQL, an open-source database package that runs beautifully everywhere I've tried it. If you are familiar with MySQL, Postgres shouldn't be a problem for you. When you want to do full-text searching from within your Django projects, you have a few different choices available to you, mostly depending on which database backend you're using: MySQL has built-in fulltext indexing which can be used in Django with some basic ORM extensions. PostgreSQL prior to 8.3 has a 'contrib' module known as tsearch2, which allows full-text indexing within your SQL queries. This is what I am going to detail below. PostgreSQL 8.3 and later has tsearch2 built-in, which is usable in Django if you follow these directions from Barry Pederson … -
Full-text searching in Django with PostgreSQL and tsearch2
Recently, I have wanted to improve the searching ability in a number of my projects. I've often added a search box that simply does an icontains filter, which works fine for small sites but doesn't scale due to the inefficiency of matching text with basic SQL queries. The plus side … -
From WordPress to Django – Part 2
Welcome back. In part 2 I'll be getting to the meat of the issue, which is retrieving the data from an existing Wordpress blog, and feeding the data into my own models. -
Django Site of the Week - ForecastWatch
Eric Floehr is the man behind ForecastWatch and ForecastAdvisor, two Django-powered weather websites that aggregate and analyse weather forecasts to compare their accuracy on an ongoing basis. This week, I spoke to Eric about the history behind his sites, how he handles massive data sets, and his conversion from Ruby on Rails to Django. You can read all about it over at the Django Site of the Week. This weeks' SOTW was delayed by a day due to our Australia Day celebrations on the 26th of January. I figured if they can delay an international Tennis match for fireworks, I could delay this as well :) -
Django Site of the Week - ForecastWatch
Eric Floehr is the man behind ForecastWatch and ForecastAdvisor, two Django-powered weather websites that aggregate and analyse weather forecasts to compare their accuracy on an ongoing basis. This week, I spoke to Eric about the history behind his sites, how he handles massive data sets, and his conversion from Ruby … -
Multi row transaction capabilities
The project in which I wrote a python script to process rows in an Excel spreadsheet interfacing with a MySQLdb and fronted on the web end using django is coming to a close. There is just one more requirement to go. They want rollback capabilities with the ability to completely rollback all actions on a particular excel file if one of the rows in the file buffs up or errors out. This is so that they can correct just that one row in that Excel file then feed the same Excel file to my Python process script without worry about the sanctity of the data of the rest of the rows.This means that I have to somehow implement a multi-row rollback functionality or application level transaction. Python's MySQLdb library supports rollback but only on each transaction. I need a "all or nothing" like functionality. This is something new for me, so I scouted around on google to get some inspiration or to see if someone else had done the same thing. I found this small transaction class by Harald Hoyer at his site. Planning to try out his stuff to see if they can fulfill my requirements. Instinctively, I feel … -
Testing time-based views in Django
There are situations where real time is important in the behaviour of some views. For example, one could write an anti-spam mechanism to prevent robots or ill-intended users to post a form too often and too rapidly. In this article I’ll present a strategy for testing such views. Let’s take a very simple example, in which we’ll let users post messages. The time constraint we’ll set is that users have to wait at least 15 minutes between 2 consecutive postings, otherwise their message will be ignored. I’ll start by giving out the code. First, the model: from django.db import models from django.contrib.auth.models import User class Message(models.Model): user = models.ForeignKey(User, related_name='messages') datetime = models.DateTimeField() message = models.CharField(max_length=100) def __unicode__(self): return self.message Nothing complicated here. Just a simple model to record the user and the time at which the message is posted. Then, we will use a setting to determine the interval of time a user should wait before posting another message (You will see later why using a setting is crucial here). In our example we pick 15 minutes. So, add the following to your settings.py file: MESSAGE_INTERVAL = 60 * 15 # 15 minutes expressed in seconds Now, on to … -
EuroDjangoCon w Pradze
Dzisiaj w internecie pojawiła się informacja że pierwsza w europie konferencja poświęcona django odbędzie się w Pradze w Czechach. Konferencja odbędzie się od 4 do 6 maja 2009 roku. Rejestracja uczestników ma zacząć się 6 lutego. Więcej informacji można znaleźć na stronie konferencji. Zapowiada się ciekawie :) -
OpenOffice.org Losing Viability
OpenOffice.org developer Michael Meeks analyzed 2008 commit data to show that the project is losing steam: decreasing numbers of commits, developers, and companies. He rhetorically asks about how the project is losing technical quality: Why is my bug not fixed ? why is the UI still so unpleasant ? why is performance still poor ? [...]