Greg Aker

Entries Tagged with: Nginx

Site Updates

Filed in: Python, Nginx, Django, Blobbing

December 16, 2010

I pushed some updates to my site here earlier this week. Updated to Django rev 14870, implemented Xapian with Haystack, ditched categories and moved to django-taggit.

So here's a quick and simple Django template tag I came up with that reads the file modification time of css/javascript files and appends a v=n query string.

from django import template
from django.conf import settings
from os.path import join, getmtime

register = template.Library()

def static_asset(filename):
    {% load static_asset %}
    <link rel="stylesheet" href="{% static_asset "css/main.css" %}" type="text/css">

    Renders a link like:
    <link rel="stylesheet ...

Read More