Django Static Asset Management

With GitHub gaining popularity amongst my peers, open source projects are a dime–a–dozen. That’s not to say they’re not worthwhile (I’ve learned loads from Norm’s homedir project alone), but more that the difficulty and relative cost of establishing new projects has been dramatically reduced by GitHub.

With that caveat in mind, I still think it’s worth mentioning my latest project: Django Static Management.

Code Management

Since YSlow was first introduced, an ongoing problem has been “how to manage your files in a YSlow friendly way?”. In Answers, the modern incarnation of which runs on Symfony, we solved this by using configuration to list the required CSS and JS files, and then having a build script run at build time to compile and minify these files. I always found this to be the most elegant way of managing your files, as they’re all stored in a single place, in a format (YML) that’s easily understood by even the most configuration–phobic front end developer.

The benefit of storing the names of these files in one central place is twofold:

  • They’re visible to all developers on a project (and not buried somewhere in a template); and
  • They’re easily accessible by automated scripts when creating a production version of a site (since YSlow preaches that we should combine our files into a single file to reduce HTTP overhead).

Unified Approach

Django itself, as my primary development environment these days, has no defined approach to handling static assets (and indeed the documentation is quite vague concerning this), so I figured as a developer in a fairly unique position (being both a Django developer and a fairly experienced front end developer), I would take it upon myself to solve this. For myself and my own preferred style, at the very least.

The interface I wanted would provide all the tools required to build and run a website (including the often overlooked development aspect of making sites), and be easy to use.

Introducing Django Static Management

It has a bad name, but here’s Django Static Management. At the moment it’s very much a 0.1 release, but it’s robust enough that people can start using it on their development environments.

All the documentation is already included in the README, so I won’t bore you with that here.

The future

One can see the future roadmap in the code itself, but to summarise:

It’s a short list, but then I had a busy day, and to be honest the desired feature list is currently quite short.

One reason this is a post on my site rather than just a GitHub project is that I’d like to draw attention and feature requests to the project over a wider audience than just my GitHub friends. I actually think this project will be relatively useful, but it’ll be more useful if people try and break it and feed back to me.