Winter with Django
The list of things I want to change on this site has just kept on growing for some time now. And it's now reached a point where, combined with my desire to learn another language (no, not that kind of language), I've decided to do a complete ground-up rebuild. It does mean, though, that I won't touch much on this site until I've got a bunch of areas working together nicely (though the intention is that the site will consist of modules that can easily be added and removed, so I could probably get the basics up and start plugging bits into it):
- Pretty URLs; I've had enough of the '?'s everywhere, even though I did make a motif of them, and want some easier-to-parse URLs; I know, for example, when I'm taking a look at a link from one site to another, a pretty URL gives me a lot more context, at least letting me know if I've read the linked article
- Some restructuring; not sure whether I want to keep the date-based system or focus on categories; and either way I think I'll move the longer articles (ie, everything under ?film and ?myth) into the general '?bits' section; they were kept apart because I felt they were the kind of thing I might revisit, so they existed independent of time; using date-based or category-based navigation makes a big difference to the way I interact with the site, particularly now that things are quiet around here (I have no entries for Nov2006 and only one for October!)
- Redo the photo gallery; I want to improve the navigation to allow links direct to a photo inside a template rather than standing alone; I want to allow 'original size' versions of the photo (at the moment I'm resizing everything to 640x480); I'm going to look at adding a watermark to the images on upload; and I want to keep some metadata around - at the moment, when I resize the image, I lose any metadata attached to the jpeg, some of which is actually interesting...
- I think I'm going to drop the Creative Commons license altogether; I'm thinking it's actually somewhat meaningless, as the basic Attribution-NonCommercial clause is just an ordinary part of copyright law; and CC allows derivative works, which isn't something I feel is particularly appropriate to the work I have on this site (under the CC license, someone could rewrite one of my articles to change its argument, then republish it (non-commercially), with attribution to me, which suddenly seems absurd); I think I'd rather just stick to what have become the defaults for internet use - assumed copyright on my articles, photos and videos, assumed freedom on code snippets, commercial use requires permission
- And a redesign or two; with IE7 released I've a suspicion people are going to start designing for the web a little differently, and I want to experiment with that (more on this in a separate entry); plus I want to find a way to show off some designs (similar to the old style switcher I had on here around the beginning of the year)
The cool kids are all using Ruby on Rails these days, so I played with it for a week to try figure out if it would suit my purposes. The complete lack of coherent documentation (ie, out of paying for a book, when I don't even know if I want to continue with the language) was off-putting, and I've been hearing some buzz about Django for a while now. Took a brief look at it and I've fallen in love. The structure seems a little more elegant, the basics better-documented, and there's a little more flexibility for working with database structures that don't quite match the language's expectations.
Where Rails is a MVC framework for Ruby, Django is similar, but for Python. The two base languages are fairly similar (though support for Python is wider and easier), but Rails tries to hide most of the Ruby, while Django has a straightforward/simplified template syntax, with support to drop into Python anywhere and at any time. The idea of the MVC (model-view-controller) structure is to separate business-logic and presentation, which is a thing of beauty, but Django takes it a little further, splitting the 'view' into Templates and Views. So the view is where I handle the presentation-of-data-logic, and the template is simply presentation - the idea being that a designer with no knowledge of the base language could build a Django template - all they'd need is a couple of field names. Breaking up logic and presentation also means there's generally only one place to go looking when debugging... And, when I've been all about separating data and presentation already with XHTML and CSS, Django suits my mindset.
So I've been playing with getting Django working on an old CD-collection system I run locally on PHP; biggest problem is that Django doesn't support composite primary keys, which is something I use in the database. (Rails doesn't support them either, but I got as far as displaying the data in Django despite the key limitation, while in Rails I could barely start the application.) Fortunately I use primary keys the way Django expects them throughout wintermute's system, so I'm hoping the database-interface will actually be easier. Working with a database it doesn't like has taught me a lot about Django though, so it's all useful... If I can't get it working as-is, I'm just going to add a primary key field to the table that uses composites; will take a little work going through and adding IDs (talking a couple thousand rows here), but it may have to be done...
Changes are afoot.
- None of these seem to get in the way (17May2010)
- IE6 and 7 on OSX (20Sep2008)
In which I run IE 6 and 7 on OSX; the entire process using free software
- Random on Windows (15May2007)
In which I am baffled by the mystery that is Windows, and once more wooed by the ease with which one can make Python work, even there
- Now ETagging Right! (17Apr2007)
In which I stop fighting the framework and let Django handle ETags the right way
- Semantics and Style :: Markup for Dialogue (30Dec2006)
- Winter with Django (02Dec2006)
- Drop that double-u-double-u-double-u-dot (08Nov2005)
- Blog/Search (07Oct2005)
- Converting Relative to Absolute links in PHP (preg_replace) (21Sep2005)
- Think You’re Fighting Spam? (14Sep2005)
- BBC backstage access (12May2005)
- funky google trick (28Sep2004)
- The name of this class, ‘abc’, conflicts with the name of another class that was loaded, ‘abc’ (28Jun2004)
- The Altar Of Reason (10Jun2004)
- Domain.com.au Feedback (17May2004)
- aligned with evil (11May2004)
- flash gallery thingy (08Apr2004)