Believe me, I am a Web designer. The reason why this page looks so odd is because you're viewing it in a browser that doesn't support Cascading Style Sheet positioning. It doesn't work in particularly old browsers. However, if you scroll down, you'll find all my content. Don't let this site fool you, I've designed plenty of sites that work in older browsers, this was just my first step towards what is the future of Web design.

heisel.org

heisel.org > Blog > Category > Django

My first Django snippet: Another Memcache status view

Thursday | February 14, 2008 | 5:50 pm  

Hooray! I posted by first Django snippet today. It’s a status view for your memcache server(s).

I had originally used this snippet, but the regex and socket thing never quite sat right with me.

Turns out that django.core.cache has a _cache object with a nice get_status() function. It returns a list of tuples — one for each server in your CACHE_BACKEND setting — the first item of each tuple is the server name/IP and port, the second item of the tuple is a dictionary with all the relevant stats you could need.

Permalink | Comments (0) | Categories: Django, Python, Technology

AJC development group mentioned at APME

Saturday | October 6, 2007 | 3:29 pm  

We’re in film!

Robin Henry, our Digital Managing Editor extraordinaire, spoke at a recent Associated Press Managing Editors conference and screened this Soundslides presentation that Emily Murphy and the AJC’s multimedia group put together.

I look and sound like a total dweeb, but wanted to take a chance to pimp the developers, designers, DBAs and sysadmins at work who make all the cool stuff we do possible!

Permalink | Comments (0) | Categories: Django, Journalism, Programming, Python, Technology

One thing I absolutely love about Django’s template loading

Wednesday | September 12, 2007 | 5:38 pm  

Is the ability to specify a series of template folders in your settings file.

Here’s what we do at work:

1
2
3
4
TEMPLATE_DIRS = (
    os.path.join(os.path.dirname(__file__), "templates"),
    os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "ANOTHERSITE", "templates")),
)

It allows us to easily share templates from ANOTHERSITE with sister/sub sites, but when/if you need to override them you just drop your new template your site’s templates folder and you’re off to the races.

Another template tip

If you use the tip above, I’d recommend putting templates that are explicity shared in a templates/shared folder.

Then you can do things like:

1
2
<!-- filename: templates/base_somethingorother.html -->
{% extends 'shared/shared_somethingorother.html' %}

It’s a minor tip, but it helps prevent collisions and alerts developers that these templates shouldn’t have any site specific code in them.

Permalink | Comments (0) | Categories: Django, Python

My duh moment - Django and it’s lack of strip filter

Thursday | August 30, 2007 | 5:35 pm  

Had a total ‘duh’ moment today at work. I wanted to perform the equivalent of Python’s string.strip method on some Django template output.

I looked on the Django documentation site but I couldn’t find a strip filter.

It took me a few minutes of consternation to figure why the developers wouldn’t include such an oft-needed filter.

And then, the aforementioned duh moment, I realized that I could just call {% myvar.strip %} — because my output is a string and you can use Django’s dot syntax to call methods, dictionary keys, etc.

Duh, I’m a moron.

So this post is written for Google in the hopes that someone else similarly consternated will find this tidbit and be un-consternated.

Permalink | Comments (0) | Categories: Django, Python

Talking Django at Atlanta Linux Enthusiasts

Monday | August 27, 2007 | 9:16 am  

A quick heads-up to any Atlanta area Pythonistas and Djangoistas, I’ll be giving a brief talk at the the September Atlanta Linux Enthusiasts meeting. As of this morning their Web site didn’t list the meeting, but it’s Sept. 13 at the Emory Law School.

In other AJC/Django news, Maura Chace, one of our fantastic Django developers at the AJC has a great writeup on integrating Mint with Django.

Props to Maura for getting listed in the Django Weekly Roundup!

Permalink | Comments (0) | Categories: Django, Python

Disclaimer: I work at The Atlanta Journal-Constitution. The opinions expressed here are my own, and do not reflect those of the AJC, Cox Newspapers, Cox Enterprises nor any other party.

Mail carrier N. Sorenson delivering Christmas mail through the snow. (Chicago Daily News/Chicago Historical Society)