Django community: Community blog posts RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Django using Eclipse IDE and Pydev
I’ve been using Wingwares python IDE for Django development for almost 2 years. The Wingware IDE has been very good but I have had a few superficial annoyances with it so decided to look around and see what other IDE’s I could use. This led me to Eclipse. The first time I had a look [...] -
AlertGrid - instant notification in Python/Django
AlertGrid is an interesting online instant notifications service (written in Python/Django) that helps reacting on the custom events (server down, script error, machine stopped) by sending SMS/phone/email notification. -
twod.wsgi 1.0 is out! (Enhanced WSGI support for Django applications)
I'm very pleased to announce that twod.wsgi 1.0 has been released, after several months of production use and preview releases! No bug has been found in the release candidate and therefore the final release has the same code as the candidate one.twod.wsgi allows Django developers to take advantage of the wealth of existing WSGI software, as the other popular Python frameworks do. It won’t break you existing Django applications because it’s 100% compatible with Django and you can start using the functionality offered by this library progressively.Get it while it's hot! -
Easier custom Model Manager Chaining
Easier custom Model Manager Chaining. A neat solution to the problem of wanting to write a custom QuerySet method (.published() for example) which is also available on that model’s objects manager, without having to write much boilerplate. -
Django 1.2 Tutorials: Django by Example
A few Django 1.2 tutorials by andreai.avk covering topics like Django admin customization, comment notification and moderation, thumbnail creation, searching and filtering, and automated testing. Current demos include a To-Do App, a Simple Blog, a Photo Organizing and Sharing App and a Simple Forum. -
What to do when PyPI goes down
Lately PyPI, the Python package index, has been having some availability issues. When PyPI goes down it really hurts Python developers: we can’t install new packages, bring up new development environments or virtualenvs, or deploy code with depedencies. Work is ongoing – see PEP 381 – to add much-needed resiliency to PyPI, and the fruits of these labors are starting to become available. In particular, a number of PyPI mirrors are now available: b. -
Setting up a template_postgis on Lucid
I wasn't able to find instructions in the Django docs for setting up a template_postgis database with postgis-1.5 and Postgres 8.4 on Ubuntu Lucid (10.04). Below is what worked for me. GeoDjango installed via Ubuntu 10.04 packages 1 2 3 4 5 6 7 8 9#!/usr/bin/env bash POSTGIS_SQL_PATH=`pg_config --sharedir`/contrib createdb -E UTF8 template_postgis # Create the template spatial database. createlang -d template_postgis plpgsql # Adding PLPGSQL language support. psql -d postgres -c "UPDATE pg_database SET datistemplate='true' WHERE datname='template_postgis';" psql -d template_postgis -f $POSTGIS_SQL_PATH/postgis.sql # Loading the PostGIS SQL routines psql -d template_postgis -f $POSTGIS_SQL_PATH/spatial_ref_sys.sql psql -d template_postgis -c "GRANT ALL ON geometry_columns TO PUBLIC;" # Enabling users to alter spatial tables. psql -d template_postgis -c "GRANT ALL ON spatial_ref_sys TO PUBLIC;" GeoDjango built from source Use the above script, but change POSTGRIS_SQL_PATH to: POSTGIS_SQL_PATH=`pg_config --sharedir`/contrib/postgis-1.5 Make sure to run sudo ldconfig after compiling everything, or else postgis won't be able to find geos. You'll see errors like this: psql:/usr/share/postgresql/8.4/contrib/postgis-1.5/postgis.sql:59: ERROR: could not load library "/usr/lib/postgresql/8.4/lib/postgis-1.5.so": libgeos_c.so.1: cannot open shared object file: No such file or directory -
Builtin template tags and filters in Django
A good feature of Django Framework is the template tags and template filters. But it sucks when you have to load the filters in each template like this: {% load mytemplatetags %} It was much better if you just use the filters, without the need to load it. The reason you have to load is to achieve [...] -
Django Aggregation Released
The aggregation is already available in Django SVN version. Now, it’s possible to do things such count authors of all book entries, count comments os all post entries, sum values of all sales to a client and much more. Here is the official documentation of this feature: http://docs.djangoproject.com/en/dev/topics/db/aggregation/ -
External apps i18n in Django
Django has the good feature of internationalization. It’s very simple to use that it generates the .po files automatically from your project. All you have to do is complete the .po file with the translated text. To create these files, all you have to do is create a folder in your project called locale and [...] -
Festival Latino-americano de Instalação de Software Livre
Venho através deste convidá-los ao FLISOL/RN 2009. O Festival Latino-americano de Instalação de Software Livre do RN irá acontecer no dia 25 de abril de 2009 no SENAC em Natal. No evento eu irei ministrar um mini-curso introdutório ao framework Django das 14:00 as 17:00 horas, cujo objetivo é formar pessoas com conhecimentos básicos acerca do [...] -
Arquivos do Mini curso de Django disponibilizados
No dia 24 de abril de 2009, no SENAC em Natal/RN, ocorreu o FLISOL. Neste evento, eu ministrei um mini curso de django. Então estou disponibilizando tanto os arquivos_mini_curso desenvolvido durante o curso, como os slides. Mini curso introdutório ao DjangoView more presentations from vbmendes. -
Documenting Django pluggable apps with Sphinx
I decided to document my Django projects with the same tool used by Django team: Sphinx. It is a very good documenting tool, and was used for many other projects, including the Python Project itself. But it has a simple problem with Django, that I found the solution rlazo’s blog. But it still has some problems, [...] -
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 [...] -
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 can filter by another’s table [...] -
Reffering to Django docs from your docs using Sphinx
Sphinx is a great documentation tool, and one of it’s built-in extensions is sphinx.ext.intersphinx. It simply takes your objects references for other projects and converts to links in the other project’s documentation. In sphinx-quickstart command, it asks if you want to add this extension. If so, It adds this code to your conf.py file: extensions = ['sphinx.ext.intersphinx'] intersphinx_mapping [...] -
get_first_object_or_none shortcut for Django
I will talk about a shortcut I developed for the Django framework and always use in my apps. This code is aimed in making a quik shortcut to obtain the first object of a queryset if it exists or None otherwise. It’s very useful when you want to display the last news in the first page [...] -
Marcus: двуязычный блог
Ещё в январе я тихо заменил здесь WordPress на самописный блог. Публично это отразилось разве что в двух твитах, и никакого поста я про это не написал. Отчасти из-за лени, отчасти от того, что всё там было довольно банально. Один из плюсов собственного блогософта в том, что к нему можно прикручивать новые фичи именно в таком виде, в котором хочется. И после реализации в блоге двуязычности, я посчитал, что стоит сделать небольшой технический обзор. Сразу скажу, что я не планировал блог, как коробочное приложение. И хотя написан он в автономном стиле, он, всё же, достаточно своеобразен и вряд ли подойдёт по фичам большинству блогеров. Код Код можно смотреть в бранче на Launchpad'е. Его получилось немного -- около 860 строк, и он, как по мне, хорошо читается. Интересно, что примерно 250 строк из всех ушло как раз на двуязычность. Впрочем, строчек непосредственно в коде блога получилось так немного, потому что много чего вынесено в библиотеки: pingdjack используется для рассылки и приёма pingback'ов scipio с его антиспам-конвейером заведует авторизацией по OpenID в комментариях subhub реализует персональный PSHB-хаб, благодаря чему посты мгновенно появляются в яндексовом Поиске по блогам и, следовательно, Подписках -- новом воплощении старой Я.Ленты. Фичи Ничего экстраординарного блог собой не представляет. … -
simplegeo's python-oauth2
simplegeo’s python-oauth2. The Python OAuth library scene is frighteningly complicated at the moment. This seems to be the most actively maintained, and the readme includes working example code for talking to the Twitter API (including integration with Django auth). -
Django Preview
A few weeks ago I started working with a local Django advocating startup called Aware Monitoring. I got straight to work attempting to replicate the features of their current (at the time of this post) website in Django. This includes a blog feature and I settled on using Nathan Borror's basic blog application. I heavily [...] -
Tutorial: Custom Feed Generation using Django Syndication Feed Framework 1.2 and later
Sometime back, when I was writing an application for my company, I took the task to implement generation of feeds. My initial choice was obviously Django's own Syndication Feed Framework which probably came with some changes in 1.2 version. Initially it looked like a piece of cake. But, for the Atom feeds the client wanted to have something which required a fair bit of customization. The current Django documentation turned out to be falling short of what I really needed, and a proper concrete example seemed to be missing. After spending a day with the given things, snippet examples, django core for the feed framework, and some help from google, I was finally able to get what was desired. So, for the rest of the post I would like to take you through the "missing tutorial" for Custom Feed Generation using Django Syndication Feed Framework 1.2 and later. This tutorial is basically for people who wants to use the framework with their own customizations coming in. For example, adding a new tag element to the item, or introducing some pre-processing checks, etc. It is assumed that you have already gone through the official documentation. Rather than giving a step by … -
Tutorial: Custom Feed Generation using Django Syndication Feed Framework 1.2 and later
Sometime back, when I was writing an application for my company, I took the task to implement generation of feeds. My initial choice was obviously Django's own Syndication Feed Framework which probably came with some changes in 1.2 version. Initially it looked like a piece of cake. But, for the Atom feeds the client wanted to have something which required a fair bit of customization. The current Django documentation turned out to be falling short of what I really needed, and a proper concrete example seemed to be missing. After spending a day with the given things, snippet examples, django core for the feed framework, and some help from google, I was finally able to get what was desired. So, for the rest of the post I would like to take you through the "missing tutorial" for Custom Feed Generation using Django Syndication Feed Framework 1.2 and later. This tutorial is basically for people who wants to use the framework with their own customizations coming in. For example, adding a new tag element to the item, or introducing some pre-processing checks, etc. It is assumed that you have already gone through the official documentation. Rather than giving a step by … -
Getting piston forms to play nicely with JSON
A commonly used tool by Djangonauts is django-piston, which is designed to make building a REST API easier. It even works with Django forms to provide easily written PUT/POST validation, which should be pretty darn nice. Unfortunately, if you go with django-piston forms validation it doesn't accomodate the JSON (or XML or YAML) requests and if validation fails it responds in HTML. Even more unfortunate, making validation accept and return JSON with PUT/POST requests is not documented.While one could argue that it is documented in the django-piston docstrings, in my opinion that is not sufficient.Fortunately while working on a project for Revolution Systems we worked out a solution:"""myapi/resource.py author: Daniel Greenfeld license: BSDThis assumes your API accepts JSON only."""import jsonfrom piston.decorator import decoratorfrom piston.resource import Resourcefrom piston.utils import rc, FormValidationErrordef validate(v_form, operation='POST'): """ This fetches the submitted data for the form from request.data because we always expect JSON data It is otherwise a copy of piston.util.validate. """ @decorator def wrap(f, self, request, *a, **kwa): # Assume that the JSON response is in request.data # Probably want to do a getattr(request, data, None) # and raise an exception if data is not found form = v_form(request.data) if form.is_valid(): setattr(request, 'form', form) return f(self, … -
Managing per-field indexes on App Engine
An annoying problem when trying to reuse an existing Django app is that some apps use TextField instead of CharField and still want to filter on that field. On App Engine TextField is not indexed and thus can't be filtered against. One app which has this problem is django-openid-auth. Previously, you had to modify the model source code directly and replace TextField with CharField where necessary. However, this is not a good solution because whenever you update the code you have to apply the patch, again. Now, djangoappengine provides a solution which allows you to configure indexes for individual fields without changing the models. By decoupling DB-specific indexes from the model definition we simplify maintenance and increase code portability. Example Let's see how we can get django-openid-auth to work correctly without modifying the app's source code. First, you need to create a module which defines the indexing settings. Let's call it "gae_openid_settings.py": from django_openid_auth.models import Association, UserOpenID FIELD_INDEXES = { Association: {'indexed': ['server_url', 'assoc_type']}, UserOpenID: {'indexed': ['claimed_id']}, } Then, in your settings.py you have to specify the list of gae settings modules: GAE_SETTINGS_MODULES = ( 'gae_openid_settings', ) That's it. Now the server_url, assoc_type, and claimed_id TextFields will behave like CharField … -
Atom feed supported
Scratch Blog now also supports Atom feed as specified in http://www.atomenabled.org/developers/syndication/atom-format-spec.php. This is also implemented using the Django Syndication Feeds Framework 1.2 and later. Some customizations have been used to let the framework generate the feed as per our requirement.