16 Blog Entries tagged: django


Using Vim and Snipmate with Django

  • September 20th, 2009 (5 months, 3 weeks ago)

Not long ago I found the SnipMate plugin for Vim, which implements some of TextMate's snippets features in Vim. A snippet is a piece of often-typed text that you can insert into your document using a trigger word followed by a tab.

I didn't find any Django snippets for SnipMate so I started my own, hosted on GitHub, snipmate_for_django. Feel free to suggest new snippets, or send me pull requests on your forks.

Around the same time I heard about Screenr, the web-based screencasting tool, and decided to try out showing off SnipMate (and NERDTree for those that ...

Read the rest »

About this entry

Date Posted:
September 20th 2009 at 8:09:52 AM

Tagged:
django, nerdtree, snipmate, vim


Django and Relativity Updated

  • May 5th, 2009 (10 months, 1 week ago)

Currently it's the season of EuroDjangoCon and I'm reading various presentations. One interesting thing I'm seeing is that many people are using relative paths in their settings.py file but in different ways. (For reference, see Django and Relativity). So far I've seen:

  1. os.path.dirname(__file__)
  2. os.path.abspath(os.path.dirname(__file__))
  3. os.path.realpath(os.path.dirname(__file__))

I've reviewed the 3 ways provided here and looked at the Python source for verification. Let's talk about each one briefly...

1) dirname

PROJECT_ROOT = os.path.dirname(__file__)

While the above might work ...

Read the rest »

About this entry

Date Posted:
May 5th 2009 at 11:05:07 AM

Tagged:
django, relative


Testing Emails with Django

  • November 20th, 2008 (1 year, 3 months ago)

Django ticket #8638 titled, "Provide setting to disable e-mail sending", caught my eye as an interesting item to look into. As I looked into it, however, I came up with a pretty simple way to set up testing that involves some settings.py changes and about 4 lines of Python code.

The big piece of magic comes from Python's built-in smtpd library and the smtpd.DebuggingServer class, which discards all e-mails sent to it and prints them to stdout.

Let's use the class to create a local mail server that will discard and print all emails sent to ...

Read the rest »

About this entry

Date Posted:
November 20th 2008 at 9:11:42 PM

Tagged:
debug, django, email, testing


A Django Management Command for Amazon S3

  • October 29th, 2008 (1 year, 4 months ago)

The Django Commands Extension project, started by Michael Trier, provides some excellent general purpose management commands to your Django projects. Ever since I first found the project I've kept it in the back of my mind that if I ever wrote a useful custom management command, I should contribute it to the project. Recently, I had the opportunity to write such a command and submit it to the project and I hope it's useful for more people than just myself.

The command I submitted is ./manage.py sync_media_s3 and it copies all the files and directory structure found ...

Read the rest »

About this entry

Date Posted:
October 29th 2008 at 11:10:51 AM

Tagged:
aws, django, management command, s3


Introducing the Django Debug Toolbar

  • September 19th, 2008 (1 year, 5 months ago)

Genesis

For some time I've been subscribed to the Symfony Project's RSS feed and have enjoyed their weekly summaries and watching another web framework grow. One of the ideas that I found while scanning a particular blog post was their "Web Debug Toolbar". I was inspired and the very same day I started the Django Debug Toolbar.

Basic Structure

I liked the fact that Symfony's Debug Toolbar was made up of distinct panels, each of which had their own rendering methods. I created the Django Debug Toolbar similarly with a single toolbar that contained many panels. The ...

Read the rest »

About this entry

Date Posted:
September 19th 2008 at 9:09:56 PM

Tagged:
debug, django


Using Gmail's SMTP server from Django

  • August 31st, 2008 (1 year, 6 months ago)

Ever since changeset 5144 Django has had the ability to send email directly through Gmail with a few extra settings in your settings.py file. I recently set up a server using Ubuntu and had no intention of receiving email on it, but I did, however, want my website to be able to send email, so this is a great solution for that case.

Gmail

Consider creating a new email account from which the email will be sent. I like to do this for a few reasons:

  1. For security reasons I don't want to list my password of my ...

Read the rest »

About this entry

Date Posted:
August 31st 2008 at 11:08:28 PM

Tagged:
django, email, gmail


Django and Relativity

  • June 20th, 2008 (1 year, 8 months ago)

My default Django settings file has changed over time to now include settings that do not depend on the location of the project on the filesystem. This is great in a team environment where more than one person is working on the same project, or when deploying your project to a web server that likely has different paths to the project root directory.

There are essentially 2 places that are looking for a filesystem path:

  1. Templates
  2. Media

Let's assume the following directory structure for a Django project:

Example directory structure

Example Django project directory structure

Project Root

One of the first things ...

Read the rest »

About this entry

Date Posted:
June 20th 2008 at 3:06:01 PM

Tagged:
django


One of our Django sites finally went public

  • March 21st, 2008 (1 year, 11 months ago)

Brain Injury Partners: Navigating the School System

I'm excited to finally be able to announce a Django project we've worked on at ORCAS that was recently released to the general public.

The website's official title is Brain Injury Partners: Navigating the School System and is designed to give parents of school-aged children with a brain injury the skills they need to become successful advocates. It was funded by the National Institute of Child Health and Human Development and made in collaboration with the Brain Injury Association of America.

This was our very first dip into Django that we started in August 2006. Since then ...

Read the rest »

About this entry

Date Posted:
March 21st 2008 at 10:03:00 AM

Tagged:
django, orcas, web


Django Book Gems: assert False

  • December 20th, 2007 (2 years, 2 months ago)

Now that it's been officially released I've started re-reading the Django book, The Definitive Guide to Django: Web Development Done Right. I'm going to start a small series on nice little snippets on bits of great information from the book as I re-read it.

One I found today while reading Chapter 3 was this:

Are you the type of programmer who likes to debug with the help of carefully placed print statements? You can use the Django error page to do so—just without the print statements. At any point in your view, temporarily insert an assert ...

Read the rest »

About this entry

Date Posted:
December 20th 2007 at 11:12:00 AM

Tagged:
book gems, django


Django Week in Review, Dec 10 - Dec 16, 2007

  • December 17th, 2007 (2 years, 2 months ago)

The obvious big news this week is that the Django Book is selling and the full text was announced available for viewing at djangobook.com.

Mailing List Highlights

Performance of a Django website: An interesting discussion on how to profile a Django website with some background information on Apache processes with mod_python.

Models over SQL views - disable regeneration of model: A discussion on disabling SQL generation when running syncdb.

Is 'LIMIT 0' a valid query?: And whether COUNT(*) or COUNT(1) is optimal for various databases.

Putting django on Amazon DB: An idea to write a Django ORM backend to ...

Read the rest »

About this entry

Date Posted:
December 17th 2007 at 8:12:00 AM

Tagged:
django, weekly update


Django Week in Review, Dec 3 - Dec 9, 2007

  • December 10th, 2007 (2 years, 3 months ago)

This post is a test of a new Django Week in Review format. I'm testing an automated script to parse the Django timeline with some minor edits and additions.

Over the following week I'll monitor a few Django resources and include links to more relevant items. If you have something you'd like included for next week I'm monitoring the Django tag on delicious and Django group on Magnolia, or email me directly.

django-developers list hightlights

Read the rest »

About this entry

Date Posted:
December 10th 2007 at 11:12:00 AM

Tagged:
django, weekly update


Installing Django on Leopard (Mac OS 10.5)

  • November 14th, 2007 (2 years, 3 months ago)

I wrote these step-by-step instructions for my work for our new Mac desktop machines. I'm posting here as well in the case that they're useful...

MacPorts

Get MacPorts with the version 10.5 in it:

http://svn.macosforge.org/repository/macports/downloads/MacPorts-1.5.0/MacPorts-1.5.0-10.5.dmg

Install it, and follow this command line history...

First check if Macports has any updates...

$ sudo port selfupdate

Python

Install Python 2.4 with readline support. I chose Python 2.4 because it's the default in MacPorts when installed other libraries...

$ sudo port install readline
$ sudo port ...

Read the rest »

About this entry

Date Posted:
November 14th 2007 at 3:11:00 PM

Tagged:
django, mac os x


Django Development Using git

  • September 17th, 2007 (2 years, 5 months ago)

A little background

Not very long ago I was fortunate to attend a talk given by Randall Schwartz on git, the distributed source control system developed by Linus Torvalds and the rest of the Linux kernel developers. After that talk and after watching the Google Video talk given by Linus I decided to dip my toe into the waters by installing git on my Mac and writing a few patches for Django.

Installation on a Mac using MacPorts

With MacPorts installed, installing a recent version of the svn variant of git is simple enough:

> sudo port install git-core +svn

Test ...

Read the rest »

About this entry

Date Posted:
September 17th 2007 at 12:09:00 PM

Tagged:
django, git


3 tips for web designers using Django

  • August 30th, 2007 (2 years, 6 months ago)

In working with a good friend and web designer recently I came up with a few tips for web designers when working with Django -- things that might not be immediately apparent when reading the docs.

Keep it simple, read the documentation

There are often times when you have a goal for the user interface and you tend to over engineer how you go about implementing it. For the most part, Django makes things very straight forward. You'd be amazed at how many things can be accomplished with generic views and the template tags/filters. So if you've hit ...

Read the rest »

About this entry

Date Posted:
August 30th 2007 at 11:08:00 AM

Tagged:
django, web


Django Master Class at OSCON 2007

  • July 24th, 2007 (2 years, 7 months ago)

The Django Master Class was a great presentation by Jacob Kaplan-Moss, Simon Willison, and Jeremy Dunck. The link to the slides and notes provided pretty much have everything in full detail, which is awesome, but here's the summary...

The format was Jacob, Simon, and Jeremy each presenting 3 of their favorite topics in Django. This format worked out very nicely, I thought, as it broke up the talk into 9 20-minute chunks.

Simon presented unit testing, forms and AJAX, and OpenID.

Jacob presented "Stupid middleware tricks", template tag patterns, and the "rest" of the stack.

Jeremy presented signals, custom ...

Read the rest »

About this entry

Date Posted:
July 24th 2007 at 12:07:00 AM

Tagged:
django, oscon


First Django Post

  • June 9th, 2006 (3 years, 9 months ago)

Hello, this is my first Django powered blog post.

I've attempted to create a blog a few times, switched to blogger, and now am creating a blog again. Mostly for the reason of learning Django. Plus, I like having things on my own server so when I forget exact URLs or passwords I can easily look them up. Anyway, welcome to my new Django powered weblog.

The body of these blogs are using Markdown, so I have to learn how to "mark up" my text with links, images, emphasis, etc. Of course that will be easy enough.

All of ...

Read the rest »

About this entry

Date Posted:
June 9th 2006 at 4:06:25 PM

Tagged:
django