- Combining HTML files with a Django website
I’ve been trying to work out how to run this site using Django, while maintaining some of old static HTML files on gyford.com at their current URLs. But I’m a bit stuck and am looking for ideas.
My website at www.gyford.com has accumulated a lot of stuff over the years. The bulk of the site (the weblog and associated pages) is currently running on Movable Type with a lot of custom PHP, and that’s the part I’m slowly re-writing in Django.
However, there are lots of other bits and pieces that I don’t want to lose, but don’t easily fit into the structure of the main website. For example:
All the flat HTML examples of old versions of this and other sites at /phil/archive/.
Domesday Witham an old, flat HTML website version of a local history booklet by my mother.
Ideally I’d like to keep all these online, at the same URLs, when I move the rest of gyford.com to a new Django site, but I’m not sure whether that’s feasible. And if it feasible, what would be the least bad way to do it.
Here are the options I’ve thought of so far:
Create a new site, under a subdomain of gyford.com, for static HTML and its images etc. Redirect the current URLs to this site. This seems simplest, but will mean changing URLs.
Host gyford.com on WebFaction which, I think, will allow me to combine a Django website with one or more “Static” websites under different directories. This sounds like it should work, and I already have PHP/HTML sites on WebFaction, but it feels fiddly.
Host gyford.com on Heroku (which was my initial aim) and use multiple buildpacks to serve the Django site and the static directories. However, I can’t see anything in the docs that say multiple buildpacks let you do this, so maybe it’s not possible.
Somehow serve HTML pages through the Django site, maybe using something like django-staticflatpages. I’ll probably do this for a couple of currently-single HTML pages (like /japanese/) but I think it’s a non-starter for larger quantities of pages (laborious to set up, very inefficient, and there are issues with relative links to in-page graphics etc).
Use Nginx on DigitalOcean (or wherever) to serve Django and then certain directories as static files. This ticks all the boxes except I really don’t want to administer servers any more.
Leaving aside option 5, option 1 seems simplest, but it feels a shame that the URLs of pages and files should be so dependent on the differing technologies used to code the site.
After so many years of running sites that are either solely Django/Flask/etc, or else solely uploading-PHP/HTML-files-to-a-shared-server, trying to combine these different things seems unnecessarily awkward.
- w/e 15 October 2017
WordPress, RSS feeds, Accident, Blade Runner 2049, Lingua Franca, Diet Cig, Aldous Harding, Back.
This week I spent more time wrangling WordPress for my mum’s website. I’m not sure what percentage of the struggle is me not knowing WordPress code well enough, and how much is WordPress’s code being odd/old/bad. Possibly all of one and none of the other. I wrote a script to import a folder of photos into WordPress, plus data about each photo stored in a CSV. And then I rewrote the code that renders a photo gallery using the WordPress
[gallery]shortcode so that it displays the titles of photos, instead of the captions, and it splits the photos into pages, rather than showing all photos on one page. This involved copying a large function from the WordPress source code and re-writing it, which feels bad and dirty… but also good that it’s possible to do this. I guess.
I also continued on the re-writing of my site, spending a day getting a combined RSS feed working. Given all the interesting and innovative things people are doing with code these days, spending so long in 2017 putting an RSS feed together seems… eccentric?
I finished re-reading Accident (1965) by Nicholas Mosley this week. I fancied something short that I knew I liked. I love a lot of Mosley’s writing although I find it hard to describe exactly why, aside from his good way with similes. Here’s a passage from near the start, when the narrator, a fellow at an Oxford college, has just pulled one of his female students, Anna, from the wreckage of a car as it approached his home:
I moved through the house like someone bankrupt before the bailiffs arrive; through the dining room, kitchen, this is where Anna and Charlie had once sat: he like a satyr taking a bite out of her neck, she a white Rubens with fruit in her hair. To the back yard where Anna might be hiding (I imagined) standing in the dark among the coal and dustbins with the trees and black clouds moving. What we have asked for; choice, freedom. I went back into the house and listened. There was the sound as if of cats in a cavern, with the rocks of walls dripping. I went up the stairs. Here Anna had once appeared with her hair dark and different so I had not recognised her. In those days we had lived so much in our minds, like policemen. I went on the landing to the spare room which had a four-poster bed and grey curtains and a square armchair. Anna was lying on the bed with shoes off and her skirt in the air, no stockings. Fallen in some ballet on a tomb. She had stayed here once before when she had come with William. Had borrowed a black nightdress which I had afterwards kept in a drawer. Her legs went up into the top of her skirt and disappeared there. Thick, rather puffy face. Boyish, like a cherub. Austrians had these faces; their eyes far apart. Her mother had been English. Anna’s mouth was open as if she had been hit. Fair hairs near the edge of it.
Her bag was on the dressing table. Two screwed-up paper handkerchiefs beside it.
I felt tears coming to my eyes. Tried to encourage them. We had lived so much in our minds, dry and waiting.
Terrified. I went down to the hall again, to the telephone. I gave a number and told the exchange to go on ringing. There was the night. Silence. The dead time. Objects coming alive and waiting.
I said “Charlie? Listen—”
We went to see Blade Runner 2049 on Wednesday, having re-watched the original at the weekend. I felt like everything I saw about the movie in the few days after it opened had been amazed, everything since disappointed. I liked it. Definitely not close to perfect but it was good enough that it was more than stunning visuals and (sometimes overbearing) sound with nothing behind it. The thing behind it could have been better in places but it was alright.
I’d seen complaints that the movie depicted women as being little more than pawns and sex objects for men. And yes. I don’t know how one tells the difference between a science-fiction movie that’s misogynistic and a science-fiction movie that’s set in a misogynistic world. I guess that if it’s the latter it should be clearer that’s the case. We don’t see enough of the world as a whole for it to be clear that this is how it works. If that’s the case more obvious signposting would be needed. Yes, the sexualised avatars, the prostitutes, the giant sculptures of women, etc, etc are clues that maybe this world is even more Trumpy than our own. But we see such narrow slices of the world it’s not made explicit that these things reflect the society as a whole. The police lieutenant is female so we guess the society isn’t entirely subjugating women; it’s no The Handmaid’s Tale… so does that mean that this society as a whole, on average, is actually more balanced than what we see, and the film-makers have emphasised the titillating-to-men aspects of it? In which case it’s them, not their imagined world, that’s the problem?
Also this week, music! I still buy music when I hear an album I like enough. This makes no real sense when I can listen to the thing on Spotify but I like the feeling I could stop paying for Spotify and still “own” the music I like most. And this week I bought three albums, more than I usually buy in a month or two.
First, Lingua Franca’s self-titled debut album (on Spotify). The internet’s automated assigners of unique IDs get confused by her fairly common name; this Lingua Franca is a linguist and rapper from Athens, Georgia. I heard, and bought, a demo of Up Close somewhere ages ago and liked it enough to buy the album. Here’s a track on YouTube:
Good fun. Finally, after watching that video I came across Aldous Harding’s NPR performance:
I’d listened to her album, Party (on Spotify), a few times when it came out and it hadn’t quite grabbed me. But seeing her perform made me listen to her differently. Something about the precision and the sense of restraining something powerful. It can only be sung like this. A few of the album tracks are a little too “folky” for me but otherwise, yes.
And, finally finally, Back finished on Channel 4 this week and I’ve enjoyed it. At first it seemed little more than Mark and Jez from Peep Show plonked into a different setting but it became its own thing in the end. It was just a shame that, in trying to keep Robert Webb’s character mysterious, he was left too blank and hard to form any opinion of. Otherwise, good. Rebecca Nicholson’s review in the Guardian was spot on and rightly picked out uncle Geoff and Cass as great supporting characters.
That’s all. Have a good week!
- w/e 8 October 2017
Personal coding, acting workshops, and my identity.
I spent the first three days of this week working on my re-write of this website, a lengthy process that I’m enjoying. A while back I spent a long time making a couple of chunks of it into code that, in theory, is reusable by other people (Django Ditto and Spectator). Trying to make them more robust and useful to more people means they took longer than if I was making them solely for my own use. So it’s refreshing to be working on the rest of the code which I don’t expect anyone else to use. Relatively, this is going more quickly. However, integrating those two “reusable” apps into my new site is a bit of a pain at times leading to a bunch of duplicate code and now-me swearing at past-me for making things more difficult through some kind of… egotistic altruism?
Another day was mostly spent on poking at some new things for my mum’s website. I can do the StackOverflow stumble through hacking WordPress to my will but trying to force particular features into a WP site through a custom plugin and theme feels like a dirty struggle at times. Especially after the control one has when writing a site from the ground up in Django (or Rails or whatever). Of course, WP has saved loads of time and sanity elsewhere, in the broad, basic strokes and with the nice admin UI.
Thursday I was thinking and writing about a character in a play in preparation for this weekend, some of which I’ve spent in workshops with some Salon Collective folks poking at ideas. (When using the word “workshop” in this context I can’t help but think of Alexei Sayle’s disdain for anyone using it outside of the context of light engineering. But hey ho.) I’m not going to be specific about what we were working on as it’s not my project, so I’d feel odd discussing the details in public.
I’ve hardly done any acting stuff this year and spending time doing this was a lovely change from internet-typing alone. At the start we had to think about our own “identities”. Which I found difficult… I’m a white, heterosexual, cis, middle-aged, middle-class, able-bodied, southern English man, which doesn’t feel like a specific enough group to feel any kind of “belonging”. It doesn’t have much sense of being different to what so much of society regards as the default (not that there should be a default of course).
I realised that, as much as anything, part of my identity is bound up in being “an internet person”: I’ve spent and shared a lot of my life online; I was online reasonably early, when it felt more “special”; and many of my friends are also in this group for the same reasons. And I now often feel frustrated because this identity isn’t what it once was. Partly this is because almost everyone’s online now so the “specialness” one clings to in this regard is more tenuous and desperate. The vanity of small differences. And partly it’s because while I once saw the internet as a broadly optimistic and equalising thing (like so many people did, and also because of my own more youthful optimism and/or naivety) now I’m more cynical and bitter about it all. The internet is more of an extension of the real world — with all its good and bad — rather than a separate and special little place where everything would always be brilliant.
Despite that, it still seems as close as I get to “my identity”, so there we go. I am at least in part, an internet person.
- w/e 1 October 2017
This week, work, Movable Type, The Destructives and the V&A.
Work… This week was finishing adding the new Django-powered features on the previous project with Hactar.
And then I dipped back in to rebuilding my own site, which is happening very slowly. Very, very slowly. Simon Willison got his blog back up and running and I have definitely fallen down the rabbit hole he avoided. That rabbit hole lead into a secret underworld of caverns and catacombs and here I am several years on, still tinkering with an unfinished site in the dark. But I’m enjoying doing so.
Friday was spent writing a script to pull blog posts out of a Movable Type database and transform it all into my shiny new Django objects. I’d forgotten about Trackbacks. Although I’m not expecting the new site to implement Trackbacks, I still want to save that old data so I can display it with the old blog posts. (In doing this I noticed that a decade ago I received 46,000 spam Trackbacks a week. Crazy days.) There’s one little bug still to fix but that importing all seems to work well. Onwards. Sporadically.
In other personal-site news I realised that one of the small-pieces-loosely-joined that still somehow makes this current version of the site function, stopped functioning six months ago. All my links on Pinboard stopped appearing where they should on this site and in my combined RSS feeds. Now it works again and I’ve backfilled the missing links.
This week in media consumption I finished Matthew De Abaitua’s The Destructives. I enjoyed his first in this loose series, The Red Men, and I liked the start of the second, If Then, but got bogged down by the second half or so and it became a chore. This time I really loved it at the start. The first third I found really interesting and just the right amount of, and kind of, science-fictionness for me. The second third wasn’t as good but was still alright, and felt more like a William Gibson macguffin-led SF thriller. But by the final third I didn’t care what happened any more. The focus had dissipated. It all felt too spread out and distant and unlikely, and I skimmed the remainder to the end.
I did like the frequent mentions of the “meta-meeting” that goes on while people have a meeting. The underlying power plays that are happening while the surface events progress. Here’s a bit:
“So you came to us with a half-fulfilled contract and a begging bowl?” Procurement was incredulous, and she looked at Lawyer and Security to see if they shared her grim astonishment.
Patricia responded with Pretend Concern, one of the seven types of silence available to the modern executive. Procurement would have expected Pretend Annoyance or even Pretend Contempt in reaction to her own miserly pantomime. Patricia left Pretend Concern in place for an uncomfortable half minute, and then uttered bland and noncommital boilerplate: “This project was always going to require flexibility on your part. The scope is unprecedented, the methods required untested.” …
The meta-meeting played bait-and-switch with mood and emotion, alternating exaggerated statements of commitment — I will flay my family to put more skin into this game — with sudden shifts into indifference. There was always a danger that if one participant in a meta-meeing adopted tactical boredom, then the others would follow suit, competing in displays of stupefaction to the point that personal assistants would be deployed to carry the participants from the room. As with any ritual, the meta-meeting was exhausting, and success was a matter of stamina: when Patricia’s face moved through expressions of Pretend Concern, Pretend Interest, Pretend Engagement, these feigned expressions were skilfully askew, enough to to sow disquiet in the heart of the other player without making her appear too mad.
Great stuff, and that kind of thing is much more immediate and interesting to me than the events of the final section.
I went to the V&A at the weekend and had a wander round with a friend. I liked the modern ceramics galleries more than I expected. It seems amazing that people can make such perfect, distinctive, and repeatable objects from a lump of mud. It was also nice to see step-by-step examples of how Walter Keeler constructs some of his pieces from several parts (things like this teapot). I also liked an Edmund de Waal piece — possibly the collector (for Paul) — solely for the idea of trying to represent the fallibility of a memory of something.
It is now nearly 11am on Monday and I’m borrowing from this week to write up last week. Tsk.
- w/e 24 Sep 2017
A little late this week. Work, Banksy, Mother! and London.
This week, on the work front, I was doing some more Django coding for Hactar, adding features to a previous project.
I was also getting almost unreasonably annoyed by the two pieces of graffiti left by Banksy just downstairs near the Barbican. Leaving aside whether the work is good or not, I’m frustrated with how differently Banksy’s graffiti is treated to any other. We’re very fortunate here that any graffiti is usually removed pretty quickly, but Banksy’s resulted in a 24-hour security guard to keep watch over it and then, five days later, sheets of clear plastic fixed to the walls to protect it.
It’s as if all burglars are pursued by the police except for this one guy who’s really cool, yeah, so whenever he does a job we send him any of the valuables he overlooked. Given that Banksy’s messages are generally “sticking it to The Man” it seems odd for his work that it’s now treated with such veneration by the authorities. He can paint whatever he likes, wherever he likes and people will fall over themselves to uncritically proclaim it as brilliant, and that it must be protected. But anyone else painting the same thing or (shock!) something even better will, rightly, see their work removed. Few other people have so much power to get their message out around London, except George Osborne shouting through the Standard. Yes, Banksy is practically George Osborne.
Grrrr. Anyway. I saw Mother! this week, which I liked, apparently a less-than-common opinion. It’s hard to say much about it without giving anything away, and it’s best seen knowing little about it. I can say that, for me, the biggest problem was that I didn’t believe Jennifer Lawrence and Javier Bardem were a married couple, happily or otherwise. Which didn’t help with suspending disbelief for the madness that follows.
I’ve managed to get through an unusual number of books recently and this week I finished London: A Social History by Roy Porter. Although I’ve lived in the city for over twenty years I don’t think I’ve read a comprehensive history of the place before and this was everything I’d want from one. I got a good sense of the city’s stuttering start and then its peculiar, and quickening, growth, along with what that meant for the people living here. London’s such a strange place.
The final chapter, written in 1994, is peculiar, and interesting, because he summarises the state of London at the time. It’s before Tony Blair as PM, before the internet, before Docklands became properly established, before the Greater London Authority, before the housing “boom”, and long before the 2012 Olympics and Crossrail. Having summarised centuries of change so well it’s odd to read what’s now a humorously patchy assessment of the state of London. It seems like anyone writing a long history of something should resist temptation, and call a halt to their narrative at least twenty years before the present day, before they lose the perspective. A minor oddity though, and still recommended.
That’s it, time to start another week.
- Week ending 17th September 2017
If these end up being this regular, I’m not sure what to call each one.
Also this week I finished the last of the 12 books (or four bigger books) of Anthony Powell’s A Dance to the Music of Time. It feels good to have finished it, like a very long run through some fine but only occasionally interesting countryside. I felt the same about C.P. Snow’s eleven Strangers and Brothers books which I read before this. Perfectly OK, and not hard to read, but it sometimes felt like it was only the finishing line that kept me going.
I’m sure plenty was written about the similarities between the series when they were published. Both are first person accounts of a man’s life during the first three-quarters or so of the twentieth century. Snow’s narrator has more humble beginnings but both have comfortable lives in London, with (spoilers!) wives and children. Both make some of their living by writing books. Neither goes into much, if any, details about their children growing up, what their life as an author is like, or reflects on how they must appear to others. We get very little sense of what either is like as a person, other than as an inoffensive, capable, sociable-but-not-extrovert observer of the people and world around them. From these accounts both men are unemotional with often peculiar senses of what’s important (Powell’s has no sooner mentioned he’s taken a fancy to a woman than the next chapter begins some time after they got married).
The authors’ styles are different but I’m not very good at analysing literature so can’t identify what these difference are, other than the most obvious (e.g. Powell’s notoriously lengthy sentences). Perhaps a parody of each will illustrate. First ‘Little Jack Horner’ as if written by Anthony Powell:
Horner had got himself established as far as possible from the centre of the room and I was suddenly made aware, as one often is by actions which are in themselves quite commonplace, that he was about to do something which would give him enormous satisfaction. He had somehow acquired a large seasonal confection which he was beginning to attack with a degree of enthusiasm I had not seen him display since the midnight feasts we had enjoyed at school. Eschewing the normal recourse to eating utensils, he plunged his hand through the pastry and extracted an entire fruit, an achievement which was accompanied by a cry of self-congratulation and a beatific expression reminiscent of some of those on the faces one sees in the more popular of the pre-Raphaelite portraits.
(From The Quotable Powell, where the citation reads “By Prof. Alan Alexander; reproduced in E.O. Parrott, Imitations of Immortality; Penguin, 1987. Originally written for New Statesman.”)
Paunceley was regaling us with the clarets of 56.
‘This is very civil of you, Senior Tutor’, observed Mainwaring.
‘Thank you, Professor of Palaeontology and sometime Fellow of Jesus’, replied Paunceley. He seemed nervous, drawn, tense.
It was a languorous February night, heady with the rich evocative reek of sweet-william. The chrysanthemums blazed in the court, a Scotch mist draped the plane trees and above, in the sky, shimmered the stars — countless, desolate, shining.
I felt increasingly uneasy about my tendency to fire off adjectives in threes. It was compulsive, embarrassing, ineluctable; but at least it fostered the illusion of a mind that was diamond-sharp, incisive, brilliant.
‘I have asked you to come here before breakfast’, continued Paunceley, ‘because I have a most unsavoury revelation to make to you about one of your colleagues.’
I glanced at Grimsby-Browne. He seemed suddenly immensely old, haggard, shrivelled. Had he committed to the unforgivable and falsified a footnote? I studied Basingstoke, the Bursar. He too seemed suddenly bowed, broken, desiccated. Had he done the unspeakable and embezzled the battles? The scent of Old Man’s Beard saturated the combination room.
‘It concerns Charles Snow’, said Paunceley.
The tension was now unbearably taut, torturing, tense. The plangent aroma of montbretia seemed to pervade every electron of my being.
The Senior Tutor’s tone was dry, aloof, Olympian.
‘I have discovered that his real name is Godfrey Winn.’
(This is quoted in Native Speakers and Native Users: Loss and Gain by Alan Davies, where the citation reads “C.P. Snow, Strangers and Masters. Martin Fagg, in Brett 1984: 326-327).” Here’s an obituary of Fagg.)
Anyway, both are perfectly fine and readable, and reading a man’s entire life, while others are born and die around them, is a little affecting, despite their unemotional tone. I’d hesitate to actually recommend anyone devote their time to a dozen novels. But if you were to go for one, Powell was the most enjoyable read.
The past four days we’ve been in the Herefordshire countryside doing not very much. A few days of little noise other than birds singing and a distant tractor. No Twitter or internet or news other than a daily “paper” and Instagram… An odd feeling of being pleasantly cut off from events and being unsure if that matters or not.
While there we watched the third season of Peaky Blinders which was, as ever, fun. I avoided the series when it started, mainly because the title somehow seemed excrutiatingly “banter”, despite being the name of a real life gang of the period. But a friend loaned us the first two seasons and once I got over the title it was much better than expected. Good performances, good characters, good settings and, occasionally, the always enjoyable and a bit silly, Tom Hardy. It compares well against the excellent Boardwalk Empire; gangsters in the same period, but in very different locations. My initial doubts are, unfortunately, occasionally confirmed when the show tries to be a bit “rock’n’roll” - every episode must feature at least one scene of slow motion swaggering or fighting to a modern rock soundtrack, as if in a Tarantino movie called Banter O’Bantface. But aside from that, we’re looking forward to the next season.
That’s all for now. Have a good week!
- This week
Some things that I’ve done, watched, read and listened to this week.
This week in quasi-work… I spent a couple of days making these charts of series of books. That was a bit quicker than expected, which was satisfying. Maybe my brain is, finally, slowly rewiring itself enough that some of D3.js makes sense.
With that working I could also make a new D3.js chart showing Samuel Pepys’ growing wealth over time. After more than 14 years there are still new things to add.
I also finished reading the latest edition of Two Scoops of Django which is full of handy learned-through-experience tips for building Django-backed websites. Very good, although I now have a list of things to change on a couple of sites. It never stops.
On telly… We finished season six of The Good Wife which I won’t say much about because I don’t want to spoil @AllSevenSeasons’ viewing. As ever though, easy and entertaining to watch, certainly not bad, but often infuriatingly nonsensical. Maybe The Good Wife is premium mediocre TV?
It’s also time for new seasons to start on old-fashioned broadcast TV. Grand Designs and Educating Greater Manchester are now both comforting in their sounds, visuals and formats. I’m pretty sure Kevin McCloud is ruder than he used to be, pretty much telling people mid-build that they’re idiots before, 95% of the time, ultimately describing their new home a triumph. At least he can admit he’s wrong I guess.
When the first Educating… series started it was brilliant to see what goes on in a comprehensive (or whatever they are these days) school. The kids with problems, the hard-working teachers, the fights, the breakthroughs, etc. But it does feel like that power is diminishing with each series because we know what we’ll get. Lots of dramatic moments, narrative arcs wrapped up in one episode, some heartbreaking and heartwarming moments, etc. It’s still interesting, just less surprising. Because they’re so similar it sometimes feels like we now accept that the bad features of the schools/kids/parents/society are just how things are, and unchangeable. It’s normal. I wonder what it’d be like to set a series in a good private school, as a contrast. I expect it would reinforce some prejudices and disabuse us of others. It might make us think of the bad features of state schools, “Oh, they don’t have to be like this.” Maybe.
Books… This week I finished Hew Strachan’s The First World War which is very good. It confirmed how little I knew about the war, my images mainly being the mud and trenches of the western front. I didn’t know much about the eastern front, and how different that was, or the war in Africa, or in the Middle East. I hadn’t thought about how important transport was, or how tactics evolved during the war, or governments having to balance the number of men fighting versus the number of men making new weapons, vehicles and ammunition. Having to change how your country works in order to fight another.
Music… This week I listened a lot to LCD Soundsystem’s American Dream and Billie the Vision and the Dancers’ What’s the Matter With You Boy? (which I just now had to add to their Wikipedia page). Both are good in different ways. I know almost nothing about Billie… but I’ve enjoyed their albums a lot.
When I listen to LCD Soundsystem I imagine a group of pale, black-clad, grim-faced New Yorkers concentrating hard on playing everything just right, making the perfect rhythm, so that their leader doesn’t throw something at them. Later they will sit together silently in a dark bar, staring into their drinks, pondering the difficulties of life.
When I listen to Billie the Vision and the Dancers I imagine a group of friends in comfortable clothing, smiling at each other, having a lovely time, whether the song is jolly or sad. When someone makes a mistake they will laugh, shake their heads, and start again. Later they will cycle into the long Swedish summer evening and have a party by a lake with people from other nice bands.
Sometimes you need one, sometimes the other.