Pelican Blog Setup
Posted on Sat 25 July 2020 in Tech • 2 min read
Setting up the parlette.org website
Web development is not my strong suit. I've dabbled in Javascript, React, Vue, and other packages and languages, but it never quite sticks with me. Python is definitely the language that I'm most comfortable in, so I always default back to that. There's a few different Python web frameworks, but I wanted one that would generate static sites so I could host it on AWS S3.
In searching for a Python static site generator, I found Pelican. It seems to be what I'm looking for, has various themes and open-source repos that can help, and has fairly straightforward configurations. I searched the Python subreddit and found this great recent blog series by Ayush Kumar Shah, and started following it for my initial setup.
AWS configuration
The biggest difference from the tutorial is that I'm hosting on AWS S3 instead of Github Pages. I tend to gravitate to AWS services, mostly because by getting more familiar with them, it helps me in my day job.
When answering the initial Pelican setup questions, I switched my answers to say 'yes' to S3 and 'no' to GitHub Pages, though I think I could have just edited the configuration file afterwards. I had to set up a few things, including:
- The domain parlette.org (done in Google Domains, not AWS)
- DNS setup for parlette.org in AWS Route 53
- A public certificate for parlette.org in AWS Certificate Manager
- A bucket for parlette.org with public permissions
- A CDN distribution in AWS Cloudfront
- An A record in Route 53 pointing back at that Cloudfront distribution
I then ran these commands:
pelican
aws s3 cp output/ s3://mybucketname/ --recursive
aws cloudfront create-invalidation --distribution-id MYDISTMYDIST --paths '/*'