Skip to content
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Circle CI CodeCov Requirements Status

書く- to write

Kaku is a Python Flask app and a small daemon designed to manage the more dynamic requirements of a modern IndieWeb site.

Currently this code is very opinionated as I am writing it for use with my own site.

Requirements and Assumptions

  • Python v2.7
  • Kaku is written using Flask and takes advantage of the builtin Jinja template handling
  • Because Kaku needs to to store state information for authentication and authorization, it requires a Redis database
  • All Micropub and Webmention calls are handled, dispatched and then an HTTP code 202 is returned.


  • Micropub endpoint /micropub
  • Webmention endpoint /webmention
  • Indieauth endpoints /login, /logout, /auth and /success
  • Token generation endpoint /token

Post source files that are determined to be new, updated or deleted will have a Kaku Event generated. This event is generated by either the Flask app as part of a web request, or by a command line call via

If a post is shown to have changed then the HTML for the post is generated and the index page is updated.


The Flask part of Kaku uses the normal Flask configuration file, see for reference. uses a json config file, see for an example of it.


All of the dependencies are outlined in a pip installable '''requirements.txt''' file.


First start the event handler

$ python --help
usage: [-h] [--config CONFIG] [--file FILE] [--force]

optional arguments:
  -h, --help       show this help message and exit
  --config CONFIG
  --file FILE      A specific markdown file to check and then exit
  --force          Force any found markdown files (or specific file) to be
                   considered an update.

$ python --config ./kaku_events.cfg

and then the Flask app

KAKU_SETTINGS=./ uwsgi --socket --module service --callable application

Kaku has available the Flask style management app


handle the following requests:

  • GET /.well-known/browserid?
  • Micropub Edit and Delete events

Debug info

curl -d mp-action=delete -d "url=" -H "Authorization: Bearer XXXX"

curl -d mp-action=undelete -d "url=" -H "Authorization: Bearer XXXX"

python --config ./kaku_events.cfg --file ~/content/2016/123/ --force

Post files example

  • -- markdown for the post, also contains the immutable metadata
  • testing-delete.json -- metadata for post
  • testing-delete.deleted -- semaphore file to mark the post as deleted
  • testing-delete.html -- generated html
  • testing-delete.mentions -- Webmentions that have been sent to the post
  • testing-delete.outboundmentions -- json blob of any current Webmention sent from the post
$ cat
Title:   testing delete
Date:    2016-05-02 03:53:14
Tags:    None
Author:  bear
Slug:    testing-delete
Summary: testing delete

this post will be deleted

[ delete/1](
$ cat testing-delete.json
  "xml": "<p>This article has been deleted.</p>",
  "author": "bear",
  "url": "/bearlog/2016/123/testing-delete.html",
  "route": "2016/123/testing-delete",
  "title": "testing delete",
  "doy": "123",
  "modified": 1462747458.57246,
  "summary": "testing delete",
  "content": "this post will be deleted\r\n\r\n[ delete/1](\r\n\r\n",
  "deleted": "2016-05-09 04:06:32",
  "html": "<p>This article has been deleted.</p>",
  "created": "2016-05-02 03:53:14",
  "key": "20160502035314",
  "year": "2016",
  "date": "2016-05-02 03:53:14",
  "path": "/home/bearim/content/2016/123",
  "slug": "testing-delete",
  "tags": "None",
  "published": "2016-05-02 03:53:14"
You can’t perform that action at this time.