A static site generator creates static HTML and markdown files to serve as a website. They’re commonly used to host blogs but not exclusively. I recently researched my options to roll a static site in Python. I’m assessing a few of them as a potential future self-hosted blogging solution for this WordPress blog. Or maybe I’ll spin up a new one!
Most “modern” websites are dynamic in the sense that the contents of the site live in a database, and are converted into presentation-ready HTML only when a user wants to see the page. That’s great. However, it presents some minor issues that static site generators try to solve.
In a static site, the whole site, every page, everything, is created before the first user even sees it and uploaded to the server as a simple folder full of HTML files (and images, CSS, etc).The Nikola Handbook – https://getnikola.com/handbook.html#why-static
Static Site Generator Python Libraries
listed in largest to smallest order by # of Github project stars
Pelican | Github – 11K Stars
Seems to be the front running static site generator in Python’s ecosystem. It contains a convenient pelican-importer tool to import existing content from WordPress, Dotclear, or RSS feeds. Enjoying the modular nature of the pelican-plugins and pelican-themes!
Lektor | Github – 3.5K Stars
Intriguing CMS project touting a “Python API”, plugins for tools like Webpack and talented maintainers including the author of Flask.
Cactus | Github – 3.5K stars
“Simple but powerful static website generator using Python and the Django template system… typical users would be designers that are tech-savvy, want to use templates, but don’t like to mess with setting up django or S3.” (Mac OS) Demo Video
Nikola | Github – 2.2K stars
Viable option to host your site with the informative Nikola Handbook walking you through each step. Plugins for Jupyter Notebooks, post processing filters, a WordPress importer command line tool and about 40 ready to go themes to find the perfect style.
Makesite | Github – 1.6K Stars
Offers less configuration, using only a single makesite.py file.
Hyde | Github – 1.6K stars
Mynt | Github – 400 stars
“Designed to give you all the features of a CMS with none of the often rigid implementations of those features.”
Staticjinja | Github – 250 Stars
“Minimalist Python library for building static websites with Jinja.”