March 25, 2008 | code, django | 7 comments
Download django-cpserver
Background
A few months ago, I got sick of trying to deploy Django sites on my cPanel server and got a VPS at Slicehost. Thanks to SuperJared, setting up Apache/mod_python behind an Nginx frontend was a snap.
I started deploying and migrating sites to the new server and kept an eye on my server resources via Munin. I had about 10 sites running on a 1GB Slice, but the Apache processes were hogging all the RAM. Restarting Apache would bring memory usage down to around 500MB, but within a couple of hours, it would be using all my available RAM, with individual proceesses using as much as 120MB.
I started asking questions and trying different options including mod_wsgi, verifying projects weren’t in debug mode, etc. Nothing made a difference.
CherryPy to the Rescue
I came across Loic d’Anterroches’ script to run Django via CherryPy and ...
Full post →
March 13, 2008 | code, django | 4 comments
Here’s a little nugget I just posted to Django Snippets. It emulates the behavior of an old Perl script I used way back when, FormMail.pl.
I often find myself needing to build a form whose contents get emailed to the site owner(s). This class let’s you call form.notify() on any form that is a subclass of it to have the fields ordered and sent in a plain text email to all users that are flagged as staff.
from django import newforms as forms
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.core.mail import send_mail
class FormMail(forms.Form):
def notify(self):
"""
Sends an email to all members of the staff with ordered list of fields
and values for any form that subclasses FormMail
"""
site_name = Site.objects.get_current().name
form_name = self.__class__.__name__
subject = '%s %s Submission ...
Full post →
March 13, 2008 | code, django | 4 comments
The newforms library is a huge time-saver, but when I first started using it, I still found myself writing tedious repetitve code to get it to function how I wanted. While I could get away with it on smaller sites, I recently built a site with some big forms on it and decided to improve my process.
HTML Rendering
First off, {{ form }} or {{ form.as_p }}, rarely cut it in real world apps. We need to be able to customize our forms to improve the layout or add extra information. I started using inclusion tags to render the form fields and labels. Here is my trivial inclusion tag:
@register.inclusion_tag('_display_field.html')
def display_field(field, alt_label=''):
"""
Print HTML for a newform field.
Optionally, a label can be supplied that overrides the default label generated for the form.
Example:
{% display_field form.my_field "My New Label" %}
"""
if alt_label:
field.label = alt_label
return { 'field ...
Full post →
March 10, 2008 | portfolio, django | No comments yet.
We recently built and launched CashOffersFast.com. It gives people an easy, no-risk way to put their home up for sale. Pre-qualified investors can then make anonymous bids on any home listed with the site.

We worked very closely with the owner of the site to convert his concept into a working web application. From the initial concept, we identified the minimal set of features necessary for the site to function, then took an iterative approach to quickly deliver those features. This allowed the owner to use our working copy for presenting the site to potential investors while we were in the middle of the development cycle.
The site is built in Django and was designed by Derek at ashwebmedia.
Full post →
March 7, 2008 | company news, django | No comments yet.
I’ve been wanting to update my website for quite a while. It got to the point that I wasn’t referring people to my old site because it had become such a poor representation of what Lincoln Loop has evolved into. I’ve also been bottling up a bunch of blogging I want to do about Django for the same reasons.
I set my sights on relaunching before this weekend and my first trip to SXSW. Since I’ll probably do more industry schmoozing there than I have in all the time I’ve been freelancing, I wanted to make sure I had a site I was proud to show off. While the site is still rough around the edges, it is done enough that I am comfortable putting it into production. Once I settle back in, I’m hoping to use this site as a platform to become ...
Full post →