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.
autoreload(args, wait=1)
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:
Name | Type | Description | Default |
---|---|---|---|
args
|
Namespace
|
contains the input-, template- and static dir |
required |
wait
|
int
|
number of seconds the devsever waits before checking for updated content |
1
|
Source code in blag/devserver.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
|
get_last_modified(dirs)
Get the last modified time.
This method recursively goes through dirs
and returns the most
recent modification time time found.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dirs
|
list[str]
|
list of directories to search |
required |
Returns:
Type | Description |
---|---|
float
|
most recent modification time found in |
Source code in blag/devserver.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
|
serve(args)
Start the webserver and the autoreloader.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
args
|
Namespace
|
contains the input-, template- and static dir |
required |
Source code in blag/devserver.py
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
|