WhakerKit

Overview

This is the implementation of the WhakerKit library. WhakerKit is a versatile toolkit for building websites with both static and dynamic HTML pages. It was developed by Brigitte Bigi, CNRS.

WhakerKit is a seamless toolkit for managing dynamic websites and shared documents.

Use cases

WhakerKit is the ideal toolkit if you want to:

It’s designed for developers who want a lightweight, flexible solution with minimal configuration.

It’s easy to deploy, easy to understand, and highly adaptable.

WhakerKit provides easy management of public and authenticated access and simplifies document sharing in collaborative environments. It is based on the following technologies:

Technical approach

The Apache server uses uWSGI to run a Python application, handled by the local wsgi.py file. The WSGI server looks for an application(environ, start_response) function, which is called whenever a request is received (via POST, GET, or any other method). This file defines a function that is an instance of the WSGIApplication class. It is instantiated with the following parameters:

Pages are dynamically generated using the WhakerPy library and are returned as either HTML or JSON, depending on the request. The dynamic HTML pages fall into two categories:

Partially dynamic pages are described in the JSON configuration file. The <head>, header, menu, and footer of these HTML pages are automatically added to a static HTML body located in the html folder. The dynamic parts are generated by Python classes.

Authors and contributors

See the accompanying file AUTHORS.md.

Get and install WhakerKit

Get it from its repository https://sourceforge.net/projects/whakerkit/, and get documentation https://whakerkit.sourceforge.io.

Download the latest ".zip" from the web page and unpack it:

> unzip WhakerKit-xxx.zip 
	

Alternatively, you can clone the repository with git:

> git clone https://git.code.sf.net/p/whakerkit/code whakerkit-code
	> python -m pip install .
	

Creating a Custom Website

Starting a New Project

Required contents:

Optional content:

Get it:

  1. Create a working directory
  2. Download and unzip WhakerKit
  3. Download and unzip Whakerexa
  4. Create a virtual environment: python -m venv .venv
  5. Activate the virtual environment
  6. Run: python -m pip install . — this reads pyproject.toml and installs dependencies

Files and folders required to launch the sample:

Editing Existing Files

All the sample files are well-commented to help developers understand and adapt the logic to their own use case.

Starts by editing the whakerkit.json to configure your project.

The whakerkit package also includes an error folder containing HTML error pages. Edit these files to customize error messages. The package also includes default icons that can be replaced as long as the file names remain the same.

Editing the Sample

WhakerKit comes with a sample directory to help you get started.

bakery.py

This file contains the CustomWebData class, which inherits from WebSiteData. It parses sample.json, stores data, and manages the "bakery" system — a concept from WhakerPy used to dynamically generate page content.

pages_resp.py

This file implements the CustomPagesResponse class. It is invoked when a requested page name is listed in sample.json. It reuses the same head, header, navigation bar, and footer, while changing only the main content, which is defined in a static HTML file.

head_node.py

Allows adding content to the <head> tag of dynamically created HTML files. You can include <meta>, <link>, or <script> elements.

nav_node.py

Allows defining the entire <nav> content of dynamically created HTML files.

Development and Debugging

Edit the file wsgi.py to adapt it to your project content. To enable debugging, modify the logging configuration, i.e. comment/uncomment the following lines:

LOG_LEVEL = 1    # Debug level
	# LOG_LEVEL = 15   # Info level
	

Launch locally

Under any linux version or macOS, launch locally the application with:

> # install required external libraries:
	> python3 -m pip install pycryptodome --break-system-packages
	> python -m pip install uwsgi
	> # launch with uwsgi service:
	> uwsgi --http :9090 --wsgi-file wsgi.py
	

Then open http://localhost:9090/

Live projects built with WhakerKit