Django community: Community blog posts RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Quelques retours post-lancement
Soyons honnêtes, je ne pensais pas écrire un second billet aussi vite, a fortiori dans la langue de Molière. Mais le feedback a été tellement enthousiasmant que je me sens presque obligé d’apporter quelques réponses à des questions qui m’ont été posées, le plus souvent en privé, à propos du site et de sa genèse. Sur le design La conception graphique n’est pas de moi ; c’est un template que j’ai acheté sur ThemeForrest, « Logical » mais que j’ai entièrement recodé et aménagé en fonction des besoins particuliers de gestion de contenus qui étaient les miens (vous pouvez comparer les sources pour vous en convaincre.) Notez que je ne suis ni graphiste, ni webdesigner de formation, mais ingénieur de fait 1. Je suis personnellement assez satisfait d’avoir pu mettre en œuvre le résultat que vous avez sous les yeux, même si j’eu bien évidemment préféré avoir conçu la charte initiale par moi-même. Que voulez-vous, on ne peut exceller sur tous les fronts ; et l’une des compétences les plus indispensables pour faire face à ces lacunes à mes yeux est de toujours savoir déléguer opportunément. Dont acte. D’autre part, et c’est un retour qui m’a été fait de nombreuses … -
Bye-bye django.comments, hello Disqus
So, I've learned my lesson. When I first set up this blog I said at great length that I'd prefer using Django's built-in commenting system than the third-party Disqus service that Mingus uses by default. Well, after a week of trying to stop a flood of spam comments, first by deleting them as they came in and then by disabling comments altogether, I've taken the plunge and reverted my changes, so I'm now incorporating Disqus. All the (13!) real existing comments have been ported over to Disqus. For those who are interested, copying the comments over was surprisingly simple. I thought I'd have to create some XML to import them into Disqus, but it turns out there is a nice API. It further turns out that the django-disqus app includes a simple management command, disqus-export, which copies the comments straight over. One issue - the fork of this app included in Mingus has some issues with this command on recent Django versions, but you just need to remove the verbosity option in the script to make it work. -
NoSQL panel on DjangoDose
DjangoDose has published a "callcast" about NoSQL support in Django. It's pretty interesting to learn about the different views on how far support for non-relational (NoSQL) DBs should go. Alex Gaynor wants to work on NoSQL backend support during Google Summer of Code and if he gets accepted (which is very likely) we might get official non-relational DB support in Django 1.3! Let me quickly summarize the most important topics that came up: Some non-relational DBs only support primary key queries (i.e., you can't query by an attribute). The way developers work around this is that they manually maintain extra "index" tables where the primary key is the attribute value that you want to filter against (e.g., username) and another attribute in that table stores the corresponding primary key (e.g., user id). For example, an entry for the username index would look like this: {'pk': 'wkornewald', 'user_id': 1} One of the big questions was: Is it enough for Django to support pk-only queries or should Django (or some separate module) take care of maintaining indexes for you? Is the admin useful if you can only query by pk? Is it sufficient if you can only browse through your database (by … -
Retiring "SuperJared"
SuperJared.com is moving to LuckyTheTourist.com. -
Release: django-treebeard 1.60
django-treebeard 1.60 has been released (CHANGES). It’s in pypi so you can install it with pip or easy_install. The documentation was also updated, using the graphviz extension for sphinx to generate pretty trees ;) You can get the code in the Mercurial repo. There is also a well maintained Git mirror. Please report bugs in [...] -
Nontrivial Django Forms Talk Text
This is the text from the Nontrivial Django Forms talk I gave last Tuesday at the April meeting of the Ottawa Python Authors Group. This talk starts where the Django forms documentation leaves off. -
Installing Python 2.5 in Fedora 12 for Google App Engine
This stupid install process gets me every time! How do you run Google App Engine which currently requires Python2.5 on a machine that has Python2.6 installed? This also goes for anybody trying to use Django with App-Engine. Everytime I try I get an error like this: Traceback (most recent call last): File "/home/andriy/lib/google_appengine/dev_appserver.py", line 68, in run_file(__file__, globals()) File "/home/andriy/lib/google_appengine/dev_appserver.py", line 64, in run_file execfile(script_path, globals_) File "/home/andriy/lib/google_appengine/google/appengine/tools/dev_appserver_main.py", line 82, in from google.appengine.tools import appcfg File "/home/andriy/lib/google_appengine/google/appengine/tools/appcfg.py", line 59, in from google.appengine.tools import appengine_rpc File "/home/andriy/lib/google_appengine/google/appengine/tools/appengine_rpc.py", line 32, in https_handler = urllib2.HTTPSHandler AttributeError: 'module' object has no attribute 'HTTPSHandler' Now some people say that you need to "compile python with ssl support". But it ain't so. There is actually nothing to configure in the python install to make it include ssl. Python finds the ssl libraries automatically if they are installed. The trick is you need the dev ssl libraries. So here it is for my own reference:Download the openssl-dev packages! Yes... you need them: sudo yum install openssl-dev* Download python2.5 Configure it: ./configure Build it: sudo make Alt-install it to make it reside near your current python install: sudo make altinstall Now download App-Engine and make sure to use … -
Integrating reCAPTCHA with Django
This is how I added reCAPTCHA captchas to TrenchMice, a Django-powered website. Background We didn’t initially build captchas into TrenchMice, because we simply didn’t think they would be necessary. By September 2006, the site started receiving spam comments. They were the usual gibberish you see in blog spam: Lots of links, garbage words, and bogus [...] -
GLAMkit is here!
The Interaction Consortium is proud to release GLAMkit, a free, open source Web framework built on top of Django, specifically for the GLAM (Galleries, Libraries, Archives and Museums) sector. Think Drupal, but but easier, GLAM-specific, with more front-end flexibility, and much better integration with existing databases. The framework is made up of loosely-coupled components, most of which can be used as standalone apps, or as part of a larger GLAMkit ecosystem. Our loosely-coupled design approach makes it easy to integrate GLAMkit functionality into existing Django sites. GLAMkit is currently in alpha development - sign up here to receive announcements about progress. We are still in the process of generalising existing code - so you can expect GLAMkit to grow very quickly over the next few weeks as we plunder our storehouse of code, which represents years of experience and hundreds of hours designing and building GLAM-specific sites. We’d love you to join in on Github or the developers’ mailing list. -
Perfect Deployment Of Websites
Recently I have been giving a lot of thought to how best to deploy websites, specifically Django powered sites. In future posts I’ll describe how I use some of tools available to deploy websites, but in this post I want to set out the goals of any system that you use to deploy a website. [...] -
Django templates not loading?
Had an annoying issue today after upgrading an installation of django to the trunk. All of a sudden, my admin interface would not load. I had errors stating that the template `admin/login.html` could not be loaded. Now, django.contrib.admin was in settings.INSTALLED_APPS, and `django.template.loaders.app_directories.Loader` was in `settings.TEMPLATE_LOADERS`. So, why was django throwing an exception? To find out, I stepped into a shell: {% highlight pycon linenos %} >>> from django.template.loader import find_template_loader >>> loader = find_template_loader('django.template.loaders.app_directories.Loader') >>> loader.load_template('admin/login.html') {% endhighlight %} This was where I realised something was wrong. I don't get the error now (as I have fixed it), but it complained about being not allowed to open the file. As in a permissions error. Looking up the location in a new shell, I was able to see that all of the files in the `django.contrib.admin.templates` directory were only able to be read by root. For some reason, `python setup.py install` had set the mode of these files to _0600_, instead of the expected _0644_. A quick `sudo chmod -r ag+r templates` (from inside the `django.contrib.admin` directory) fixed it. -
Temporary models in Django
Occasionally I need to create a temporary model within a Django application. The most recent occasion for this was a one-off management command I was writing to import some data from a legacy system. The old database, for some reason, eschewed foreign keys in favour of char fields in a linking table which referred to the relevant rows. In converting this to a Django app, and wanting to use sensible database structure, I planned to replace this with normal ForeignKey fields. But I needed to temporarily hold onto the old references during the import process, so that I could set the new FK properly. I didn't want to add a field to my model, create a migration for the new field, do the import, then add another migration to drop the field again, so a quick answer was to create a temporary table to hold the linking data during the import. And I wanted to define it within the management command itself, again so as not to pollute the real models with temporary code. Surprisingly, this turned out to be quite easy. Here's the code: from django.db import models, cursor from django.contrib.contenttypes.management import update_contenttypes from django.core.management import call_command class TempCustomerAddress(models.Model): … -
Temporary models in Django
Occasionally I need to create a temporary model within a Django application. The most recent occasion for this was a one-off management command I was writing to import some data from a legacy system. The old database, for some reason, eschewed foreign keys in favour of char fields in a linking table which referred to the relevant rows. In converting this to a Django app, and wanting to use sensible database structure, I planned to replace this with normal ForeignKey fields. But I needed to temporarily hold onto the old references during the import process, so that I could set the new FK properly. I didn't want to add a field to my model, create a migration for the new field, do the import, then add another migration to drop the field again, so a quick answer was to create a temporary table to hold the linking data during the import. And I wanted to define it within the management command itself, again so as not to pollute the real models with temporary code. Surprisingly, this turned out to be quite easy. Here's the code: from django.db import models, cursor from django.contrib.contenttypes.management import update_contenttypes from django.core.management import call_command class TempCustomerAddress(models.Model): … -
Django Editor - plugin for Eclipse
Django templates (tags, blocks, variables, filters, HTML tags, JavaScript and CSS) syntax coloring support for Eclipse. -
An end to my Evolution
I am stepping down as a maintainer of one of my open source projects - Django Evolution. This shouldn't come as a surprise to anyone - there hasn't been any significant development work done on Evolution in over a year. My personal commitments and my work on Django core are absorbing all my free time at present. As a result, I can't give Evolution the attention it needs or deserves, especially given the changes that will be required to update Evolution to work with Django 1.2. For me, Evolution was always a bit of an experiment. The documentation has always warned that Evolution was not production ready, and the bug tracker would back up that assessment. My aim with Evolution was to demonstrate that a semi-automated migration framework was possible, and to hopefully kickstart a development effort that would ultimately lead to a merge into Django's trunk. In a way, this has happened, just not in the way I intended. Following the release of Evolution, other schema migration projects have been announced -- most notably, South -- and these project provide alternate approaches to the schema migration problem. Some of these projects have been successful, some have not; some have … -
Introduction to Surlex
Introduction to Surlex. A neat drop-in alternative for Django’s regular expression based URL parsing, providing simpler syntax for common path patterns. -
Writing a non-relational Django backend
"The Django ORM is pretty complicated and it takes too much time for contributors to understand all the necessary details. In order to make the process as easy as possible we've implemented a backend template which provides a simple starting point for a new backend based on our simplified API. It also contains sample code, so you can better understand what each function does." by All buttons pressed -
Helping you see what’s happening.
This week we improved the activity views to help you better understand what people are doing on the site. You can see them in action on your dashboard or on any user's profile page like this. We also added a What’s cooking page to share our plans for what we're working on. We'd love to hear your feedback about it! This week’s featured recipe is CT Morrison’s Pasta Dough (With Gluten Free Conversion). She has entire set of gluten-free recipes that are well worth checking out. -
What Is Your Version Of Django
In my professional and personal projects I’ve run into alot of different versions of Django. Out of curiosity can you leave a comment indicating which version of Django you are using? Thanks! -
Writing a non-relational Django backend
In our April 1st post we claimed to have a simplified backend API. Well, this wasn't true, of course, but yesterday it has become true. The Django ORM is pretty complicated and it takes too much time for contributors to understand all the necessary details. In order to make the process as easy as possible we've implemented a backend template which provides a simple starting point for a new backend based on our simplified API. It also contains sample code, so you can better understand what each function does. All places where you have to make changes are marked with "# TODO:" comments. Note, you'll need djangotoolbox which provides the base classes for nonrel backends. Let's start with base.py. You can use the DatabaseCreation class to define a custom data_types mapping from Django's fields to your database types. The types will later be passed to functions which you'll have to implement to convert values from and to the DB (convert_value_from_db() and convert_value_to_db()). If the default values work for you just leave the class untouched. Also, if you want to maintain a DB connection we'd recommend storing it in DatabaseWrapper: class DatabaseWrapper(NonrelDatabaseWrapper): def __init__(self, *args, **kwds): super(DatabaseWrapper, self).__init__(*args, **kwds) ... self.db_connection … -
Retiring Old Posts To Keep Django Fresh
Times change and so does Django, why would this blog be any different. I personally wish more people would do a little spring cleaning here and there. There are few things more frustrating than outdated posts derailing my searches. So to keep it brief here are a few articles that are going away because [...] -
Django-Reporter
This week I finished up the initial release of Django-Reporter, my first open-source project based on work I've done for my full-time employer, Pegasus News. At Pegasus we send daily, weekly, and monthly email reports out to several people. We have a quite complex codebase, so we need these reports to be as flexible as possible. Limitations of the old way Previously, we were creating one-off executable report scripts and collecting them in a directory on the main web server to be hit by cron periodically. This involved a lot of boilerplate code and duplication, and became difficult to manage long-term - especially when we switched from a single-site to a multi-site structure and a lot of the reports broke. Also, we had to include different DJANGO_SETTINGS_MODULE values depending on the site the report was for, and that filled up the crontab with a lot of verbosity. Classes, registration, and a management command My solution was to make the reports class-based, so that we could implement certain methods on each report that handled what makes those reports different while letting the base class handle what stays the same. We subclass the BaseReport class, implement methods for the subject line and … -
Announcing colibri 1.0 alpha1, a mailing list manager with a django based web interface
It has been more than one year now that I’m running my own mailing list software here at freehackers, and I think it is now time to release a first preview of it. Let me introduce Colibri 1.0 alpha1 Colibri is a free software (GPL), based on python and Django. It’s not feature complete, but […] -
Actualitzat vimrc
He actualitzat la meva configuració de .vimrc i els pluggins i ressaltat de sintaxi que hi ha a .vim El subversion: http://code.google.com/p/appfusedjango/source/browse/#svn/trunk/myvim El .vimrc El .vim Novetats Substitució de snipEmu per snipmate. SnipMate fa si fa o no fa el mateix però té una sintaxi més senzilla i clara i permet fer nous snippets molt més fàcilment. He afegit un nou ressaltat de sintaxi per json. El colors per defecte per gvim passa a ser ara wombat i he canvait el tipus de lletra a DejaVu Sans Mono, ja que té una bona distinció entre la vocal O i el zero, entre l'u i la i, bastant millor per programar. Activació per defecte dels menús i de la toolbar a gvim Neteja de la configuració a .vimrc Pos els alias a un fitxer apart dins ~/.vim/abbr, feu alias per veure el que hi ha. Integració de més codi de pycopia especialment dels snippets per Django. 0 comentaris, 0 trackbacks (URL) Automatic translations of this post by Apertium -
Changing the Django Admin site title
Often the Django Admin should look a little different for the sake of your users or for the sake of yourself (running multiple django sites with identical looks and titles can be such a pain). Often users don’t know what Django is, and it takes ages to explain, and even after that they have no clue. Also, often my administration has nothing to do with a website, so I don’t want the text “Site administration”. First of all, you wanna add templates/admin/base_site.html to your project. This file can safely be overwritten, since it’s a file that the django devs have intended for the exact purpose of customizing your admin site a bit. Here’s an example of what to put in the file: {% extends "admin/base.html" %} {% load i18n %} {% block title %}{{ title }} | {% trans 'Some Organisation' %}{% endblock %} {% block branding %} <style type="text/css"> #header { /* your style here */ } </style> <h1 id="site-name">{% trans 'Organisation Website' %}</h1> {% endblock %} {% block nav-global %}{% endblock %} This is common practice. But I noticed after this that I was still left with an annoying “Site Administration” on the main admin …