Skip to content
Snippets Groups Projects
user avatar
James Vasile authored
It turns out that 'site' is a standard module, and if you are using
pytest and try to `import site` python gets confused about which `site`
you mean.  We could untangle that via some sys.path hacking or import
module munging, or maybe just symlinks, but this is cleanest.
b926e9ac
History

blog.opentechstrategies.com

This is OTS's blog backend. It contains:

  • Pelican config
  • Jinja templates
  • Blog posts, pages, uploaded media

Developing And Writing Posts

In a terminal, do this:

git clone https://code.librehq.com/ots/ots-blog.git
cd ots-blog
./bin/build
./bin/serve

Then you can view the site on localhost:8000.

New posts go in sites/content/posts/. When a post is ready, add it to the git repo.

git add PATH/TO/POST
git commit -m "Add new post"
git push

TODO: add instructions for actually taking a post live. Theoretically, they should be able to just rsync it somewhere, but maybe we should check out the repo server-side and then do a git pull and bin/build. Alternatively, there is a the push script in bin that rsyncs to opentechstrategies.com.

Dependencies

Pelican and Python

You will need Pelican with the markdown plugin. You can install it and the search plugin with:

pip install -r requirements.txt

If you want to work on the code, you will probably want the dev dependencies too:

pip install -r requirements-dev.txt

You might have to fiddle with a virtual environment, but that will be specific to your system, so I leave that to you.

Stork Search

Search is disabled in the local dev version by default. If you want to install and enable it, see below, but you can safely ignore this if all you want to do is write a post or develop non-search parts of our blog backend.

Our search is based on Stork. You need the binary to make search work. You can download the v1.6.0 binary appropriate to your system from their GitHub Releases page. Put it in your bin directory (if it's on your path via .envrc or somesuch) or somewhere else on your path. If you're on Debian or Ubuntu, you can do this:

cd bin
wget https://github.com/jameslittle230/stork/releases/download/v1.6.0/stork-ubuntu-22-04 -O bin/stork-v1.6.0
chmod +x stork-v1.6.0
ln -s stork-v1.6.0 stork

Enable with SEARCH_ENABLE=True in pelicanconf.py.

License

GNU General Public License, Version 3 or later.