Push-to-deploy static sites with Pelican, Flask and Github
Published on 2014-01-05
After reading about how Nicolas Gallagher deploys static sites with Git, I started wanting to develop my own push-to-deploy flow to use in a Pelican-generated static site I’ve been working on. Turns out it was pretty easy to implement.
I wrote a deployer script which is basically a
Flask app that receives Github webhook requests.
Decided to use Github webhooks as trigger instead of a
since the repo I was working with was in Github anyways. I also like using
their code editor for quick fixes. When the app receives a hook request, it
starts pulling the latest changesets. Then it runs
pelican to build updated
static files and put them at the path I pointed
nginx to serve. Simple.
Here’s a gist of the script: https://gist.github.com/marksteve/8243318
Right now it can only auto-deploy one repo. but I’ll definitely add support for multiple repos when I get the time to.
Update: Now supports multiple repos :)