I got a free few minutes to work on my own site here. Since I migrated the site from all static pages to Django served, I still haven’t put back the favicon icon back onto the site. The sites runs under a virtual host in apache2 at WebFaction. This is what you need to put [...]
Serving favicon in an Django App using Apache
August 13th, 2008 · 2 Comments · django
Tags: django
Resetting Django Admin Password
August 7th, 2008 · 1 Comment · django
This barely qualifies for a blog post, but what to do if you loaded, via django-admin.py loaddata
a full json file from someone during testing, and don’t have their user’s password?
Just run the django-admin.py shell, and by hand reset all the passwords:
from django.contrib.auth.models import User
for u in Users:
u.set_password(’secret’)
u.save()
That’s why you have to keep your shell login [...]
Tags: django
J2EE to Django, slides for the Presentation at Cambridge Python Meetup
June 29th, 2008 · No Comments · django
I gave a short presentation on Django to the Cambridge Python Users group earlier. Nate has a great writeup of the event and the other presentations that evening. I just want to share the slides here. The slides are just visual reminders and do not stand on their own. If you want more info free [...]
Tags: django
Django Tip: No leading slash for upload_to for FileField and ImageField
May 9th, 2008 · No Comments · django
This is a common mistake. When defining a FileField or an ImageField, you need to specify
where the files are stored. This is done by specifying a relative path in the upload_to
argument. Django will then store your files in a subdirectory as named, under the MEDIA_ROOT
directory. But, don’t put a leading slash in the relative path. [...]
Tags: django
Django Tip: Outputting list of items separated by commas, but only if it has more than one item
April 24th, 2008 · No Comments · django
How many times do you need to do this? You have a list of things to output. The list can be empty, has one element, or more. You want to separate each items with a separator for readability. What do you do?
1. The simple but not reader friendly way:
toppings = [ 'cheese','tomatos','pineapple' ]
or toppings = [...]
Tags: django
gettext on Leopard for Django Internationalization
January 30th, 2008 · No Comments · django, mac
I started working on one of my internationalized applications on the new Mac. I realized I did not install “gettext”, which is required by the make-messages and compile-messages scripts. I want to avoid installing things into OS X if I can. Then I found the easy way out:
1. Install poedit for os x. I need [...]
Tags: django
Django on Leopard
January 20th, 2008 · No Comments · Uncategorized, django, mac
Part of the reason I was waiting to switch from using Windows XP (gasp) as my Django development platform to OS X is that it is actually easier to install the platform on XP. Windows does not come with any of the tools, so it was a matter of installing the version that I need. [...]
Tags: django
Django 0.96 Internationalization
January 6th, 2008 · No Comments · django
I am trying out Django’s i18n support and found a few issues. This only applies if you are using newforms and Django 0.96.
Order of Middleware
First, the order of the middleware is important. It is defined in the documentation, but I missed it the first time around. You have to put the localeMiddleware after SessionMiddleware:
MIDDLEWARE_CLASSES = [...]
Tags: django
Using pytextile in Django - problem with unicode
October 4th, 2007 · No Comments · django, technology
I am coverting a J2EE application over to django. The existing app uses Textile as a simple markup for user text input. After installing pytextile (which is under ownership change at the moment), I found a problem using it:
The “textile” filter works for strings and strings retrieved from my database, but when I try to [...]
Tags: django
The Importance of the initial argument in Django newforms library
September 19th, 2007 · No Comments · django
I like Django a lot. In fact I am in the middle of converting a large J2EE application to Django. Sometimes I run into a problem using it, and knowing Django, I know there is a good solution. To find the solution however, sometimes require very careful reading of the documentation.
Case in point. The solution [...]
Tags: django