Posts About Django

Building a Community Site with Django in 40 Hours or Less

July 20, 2008 | trailmapping, django | 9 comments

All the recent hub bub about 1 week and 1 day application development, motivated me to see how quickly I could launch a website for myself. I, like many developers, struggle with building and releasing personal sites. Ask a web developer and they’re likely to tell you about a couple of sites they started and never finished. Time is always an issue, but the bigger problems are striving for perfection prior to launch and always holding out for that one “killer” feature. As time goes on, interest in the project wanes until it finally gets shelved.

The Plan

Prior to development, I set a few goals for myself:

  1. Launching quickly was priority number one. I set a goal of 3 days.
  2. Use as much existing code as possible. Even if it wasn’t a perfect fit, if it was functional, use it.
  3. Optimize later.
  4. Stop scope/feature creep at ...

Full post →

Django Newforms Admin Merged to Trunk

July 18, 2008 | django | No comments yet.

This was a huge feat. Congrats guys! 1.0 here we come.

Full post →

Django for Hire

June 26, 2008 | company news, django | 3 comments

Lincoln Loop has been in “head down” mode for the last couple months. In addition to being knee deep in client projects, we have grown from a one-man development studio to a full-fledged Django development shop/consultancy. We are proud to announce that Lincoln Loop is the first (that we know of) company focusing solely on Django application development. Our development team is currently five strong and oozing with talent. Each member contributes to the community in blog posts or open source add-ons; a few of us have contributed code to Django itself. More on our dev team in the near future.

We went through the typical growing pains during the transition, but the kinks are worked out and we can officially say that we are open for business. Django projects big and small, send them our way. Our devs can handle nearly anything.

  • New Django projects based on your ...

Full post →

Getting RequestContext in Your Templates

May 10, 2008 | code, django | 10 comments

Lately, we’ve been taking over projects from people who began building their first site in Django, but either got in over their head or just found they didn’t have the time to continue. As I review the existing code, the first issue I typically see is using the render_to_response shortcut without including the RequestContext, preventing context processors from being used in the templates. The standard symptom is when people can’t access MEDIA_URL in their templates.

Here are a few ways to add RequestContext to your templates.

Option #1: Adding RequestContext to render_to_response

The Django documentation recommends passing RequestContext as an argument to render_to_response like this:

from django.shortcuts import render_to_response
from django.template import RequestContext

def my_view(request):
    # View code here...
    return render_to_response('my_template.html',
                              my_data_dictionary,
                              context_instance=RequestContext(request))

This works, but as you can see, it adds a fair amount of repetitive code to your views ...

Full post →

Google App Engine First Impressions

April 8, 2008 | code, django | 2 comments

For those of you that have been hiding under a rock for the last 12 hours, App Engine is Google’s answer to Amazon Web Services. While it is less flexible in some senses (you don’t have a complete OS at your disposal), it does provide tighter integration for web applications and even includes a (somewhat crippled) version of Django out of the box.

I’m pretty excited about this mainly because I’m not a big fan of server administration, so I took a couple hours this morning to test it out. Here are some quick notes:

The Good

The ...

Full post →

Reusable Django Apps and Forking

April 4, 2008 | code, django | 14 comments

One of the things that drew me towards Django was the idea of being able to create reusable applications that would sit on my PYTHONPATH instead of copied across multiple sites. Coming from WordPress, the constant security updates that required me to revisit old projects began to drive me mad.

Trouble in Paradise

With some real world Django experience under my belt, I find myself re-using apps all the time, but not how I originally expected. A fair amount of my client work comes from building content management systems, so I started out building a generic app like flatpages but more extendable and a blogging app. I dropped them in my PYTHONPATH and started adding them to INSTALLED_APPS on my projects.

Over time, they evolved and improved, but they started to handcuff me. I started thinking things like, “This would be a great feature for Project X, but it would ...

Full post →

Serving Django via CherryPy

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 →

Django FormMail Clone

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 →

Better Use of Newforms

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 →

Cash Offers Fast Site

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 →

Page 1 of 2
← older posts

Thanks for checking in on our blog today. Want to learn more about Lincoln Loop? Visit our home page.

Categories

Archives

Elsewhere

What I’ve been up to online

  • #5247: patch6702.diff - Django Code - Trac
    08.08.04, 20:30 #
  • #5247: patch.diff - Django Code - Trac
    08.08.04, 20:30 #
  • Anybody want to split a hotel room for #DjangoCon?
    08.07.31, 9:42 #
  • Just got confirmation I'm on the invite list for #DjangoCon. Being a member does have its benefits. Couch surf or hotel?
    08.07.31, 9:02 #
  • Admin Image Widget
    08.07.31, 6:28 #
  • Follow @trailmapping for Trailmapping.com updates. Just pushed some slick jQuery into production tonight.
    08.07.31, 1:53 #
  • Munin :: com :: djangoproject.com :: trac_tickets
    Graphs of trac tickets for Django
    08.07.29, 12:00 #
  • Automating tests in Django | Eric's Site
    Generate tests by simply clicking through your development site.
    08.07.24, 9:23 #
  • Creator/updater fields for admin
    08.07.21, 16:16 #
  • fairview computing :: Django geography hacks
    Nice base for a reusable Locations app for Django
    08.07.10, 16:58 #
  • working with a designer
    Great tips on how to be a good client to your designer and get the most out of him at the same time.
    08.07.09, 23:45 #
  • Fluency Admin at deanjrobinson.com
    Elegant WordPress admin interface
    08.07.09, 16:43 #
  • Search Docs with Shortwave
    08.07.08, 5:00 #
  • django-chunks - Google Code
    Handy little project for managing CMS content snippets.
    08.07.07, 16:53 #
  • Norbauer Inc: The Boston Ruby on Rails Development Consulting Firm
    I love 1 page websites. Short, sweet and to-the-point.
    08.07.02, 9:21 #

Interested in working with us?
Fill out the form below or contact us at:

PO Box 774441
Steamboat Springs, CO
80477

970.879.8810
info@lincolnloop.com