Pelican
In the endless cycle of tinkering with this website I have once again changed things around. I had a go at modifying a bash script (BLASH) to parse my markdown files into the html files you’re now looking at. Very quickly the loops and structures became ungainly. No doubt my lack of finesse, skill and time was to blame. I switched to Python and very quickly realised the code required was much less clumsy. Nikola which uses Python had been serving me well for sometime but I was finding the devlopment process a bit obtuse. I swapped Nikola out and replaced it with Pelican. Both are coded in Python which is so much more manageable than bash.
Words are written and saved as plain text files. I use markdown for the the links and stuff. Then I run a script to smush the text/markdown files into a some html files. This has been my basic requirement for managing this site. My preference for work and domestic life means my time to tinker or write is often interrupted and curtailed.
The writing and publishing process I used with Nikola was ok. The html template development process was confusing for my time-strapped-and-interupted brain. It was just too annoying, I was probably doing something wrong but I never had time or the patience to figure it out. It was me Nikola, not you.
Python comes in a myriad of versions and runs on dozens of platforms. Developing something with any consistency requires a virtual development environment. Over the past few years I have used a variety of mostly horrible methods to manage this. It was only recently I settled on venv.
In short the vague process for me has been
- set up my python virtual environment
- activate my development environment
source bin/activate
and install dependencies. - install Pelican
- write stuff, set up a theme and publish
- tinker with it all until it breaks
- rinse, repeat.
Once I have activated my virtual environment I use Pelican to build and publish the site using something like this, pelican /path/to/my-markdown-files
Pelican can regenerate the site on the fly. I have been using a variety of commands pelican regenerate
, invoke regenerate
(Invoke is a seperate project). Out of habit I generally run a dev server in one terminal, python -m SimpleHTTPServer 8000
and rebuild with, pelican content -o output
command in another. This command, pelican --autoreload --listen
does both, I should probably use it.
I sync my development site to the server using rsync. Having created a makefile with all my settings I can just use, make rsync_upload
which does the job. I used to try and use git but as I am the only one playing with the files I’m not sure what the point is right now. Well, apart from the tinkering.
Tinkering To Do List:
- reinstate all the pictures, you may have noticed all the broken img placeholders.
- replicate the dev environment on a server not just my laptop, with a view to publishing from my phone.
- posts with some automation to map my bicycle rides
Comments
Add a comment?There are no comments yet.