Kaktos is a Python Static Site Generator.
The idea is create a simple static site generator for people that don't need server-side languages.
Designers can use it too, since it don't need people that know a programming language.
Cloudflare:
Netlify:
Amplify:
https://main.d27ze19drzixy0.amplifyapp.com
Render:
- Python 3.8+
Install python dependencies:
python3 -m pip install -r requirements.txt
To work in development mode, you only need execute one command:
python3 kaktos.py
When you change any file locally, the server will process
it again and auto-refresh
on browser.
This command always force use development mode, with or without environment variable.
To generate production files, you only need execute one command:
python3 kaktos.py build
All files will be generated in build
folder.
If you set environment variable KAKTOS_DEBUG=True
, kaktos will build all files for development mode, example:
KAKTOS_DEBUG=True python3 kaktos.py build
If you want start a web server to test files inside build
folder use:
python3 kaktos.py serve
Netlify:
Render:
kaktos.py
= main file that process your commandrequirements.txt
= python dependency listtemplates/layouts
= folder for all layouts that pages can inherittemplates/pages
= folder for pages that will be generatedtemplates/shared
= folder for parts of layouts that can be shared with other layoutsmodules
= kaktos modulesmodules/config.py
= configuration filefiles
= folder that contains all assets and custom filesextras/config
= folder that contains some configurations for dynamic sample data
Each command supported by Kaktos is a Python file located in the modules/commands/
folder.
To add new commands, simply create a new Python file in the modules/commands/
folder and implement the def run(params={})
method within it.
All templates (html files) are based on Jinja2 library. You can see it here:
https://jinja.palletsprojects.com/en/3.0.x/
Each service that build the static content automatically use a specific python version.
If you need change the python version used to build all files and pages, edit file runtime.txt
and change to 3.8
, 3.9
or other.
These services that im using have this python version:
- Netlify: Python 3.8 (https://docs.netlify.com/configure-builds/available-software-at-build-time/)
- Cloudflare Pages: Python 3.11.5 (https://developers.cloudflare.com/pages/configuration/language-support-and-tools)
Invalid Jinja2 syntax can prevent your HTML template from being built.
Check your terminal to see the error message, the HTML file and the line number where invalid syntax was detected.
All images for demo i got from:
Copyright (c) 2021-2024, Paulo Coutinho