Stapy is a Static Site Generator. It works with Python on any operating system without additional packages.
Stapy is a Static Site Generator (SSG) that works with Python on any operating system without requiring additional packages.
Features:
Requirements: Stapy needs Python 3.6 or newer to function.
Installation: The latest Stapy release can be downloaded and unzipped for use.
Serving: Stapy includes an HTTP server that allows you to preview your site locally. You can start the server using python3 stapy.py
and navigate to the displayed URL in your browser.
Building: When your site is ready, you can build it for publishing using the command python3 stapy.py build
.
Environments: Stapy generates static files in the web
directory, with subdirectories for different environments such as devel
and prod
.
Theme: Stapy uses themes to define the look and feel of your website. The theme.json
file in the source
directory specifies the theme to apply and its parent theme.
Resources: Stapy copies static assets such as JavaScript, CSS, and images from the source/assets
and themes/{theme}/assets
directories into the environment directories.
Routes: Stapy uses JSON files in the source/pages
directory to define routes for pages. The name of the JSON file corresponds to the URL path.
Page Data: The page JSON files contain the data required to generate the page, such as the template, title, and content.
Layout: Stapy uses html.json
files in the themes/{theme}/layout
directory for default HTML page configurations. These layouts are merged with the page's JSON file.
Template: The main template file serves as the skeleton for the page.
Plugins: Plugins allow you to add custom code when rendering the page. You can use plugins to modify file content, update page data, or handle custom HTTP responses.
Deployment: The files in your production environment (e.g., web/prod
) must be exposed for deployment.
Safe Mode: Stapy offers a safe mode that disables reserved routes and hides error messages, useful when hosting on a remote server with multiple users.