blag.devserver

Development Server.

This module provides functionality for blag’s development server. It automatically detects changes in certain directories and rebuilds the site if necessary.

Functions

autoreload(args)

Start the autoreloader.

get_last_modified(dirs)

Get the last modified time.

serve(args)

Start the webserver and the autoreloader.

blag.devserver.autoreload(args: Namespace) NoReturn

Start the autoreloader.

This method monitors the given directories for changes (i.e. the last modified time). If the last modified time has changed, a rebuild is triggered.

A rebuild is also performed immediately when this method is called to avoid serving stale contents.

Parameters

args – contains the input-, template- and static dir

blag.devserver.get_last_modified(dirs: list[str]) float

Get the last modified time.

This method recursively goes through dirs and returns the most recent modification time time found.

Parameters

dirs – list of directories to search

Returns

most recent modification time found in dirs

Return type

float

blag.devserver.serve(args: Namespace) None

Start the webserver and the autoreloader.

Parameters

args – contains the input-, template- and static dir