8 Promising Python Static Site Generators
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 them as a potential future self-hosted blogging solution for this blog.
Why Statics?
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
Port from Jekyll, a Ruby static site generator. It has since formed its own "evil twin" identity.
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."
Additional Resources
- PyLadies.com, created with Mynt
- FullStackPython.com, created with Pelican
- GetLektor.com, created with Lektor
- Hugo, a Go static site generator
- How to Build a Low-tech Website? (featuring Pelican)
- One convenient way to serve your static files up on the web is with a CDN like Cloudflare Pages.
- You can research more projects on Jamstack, a site I found helpful for finding these libraries.
Update! I launched a Pelican blog about investing with Cloudflare pages. It's my first live static blog. Read more about it here.