httk.serve.web.api¶
Expose high-level helpers for serving and publishing web sites.
Functions¶
|
Create an ASGI application for a site source directory. |
|
Run a development server for a site source directory. |
|
Render a site source directory into static output files. |
Module Contents¶
- httk.serve.web.api.create_asgi_app(srcdir, *, baseurl=None, compatibility_mode=False, config_name='config', debug=False, table_token_secret=None)[source]¶
Create an ASGI application for a site source directory.
- Parameters:
srcdir (str | pathlib.Path) – Site source directory.
baseurl (str | None) – Optional site base URL used when building links.
compatibility_mode (bool) – Whether to use legacy site conventions.
config_name (str) – Configuration module name.
debug (bool) – Whether to enable Starlette debug responses.
table_token_secret (str | bytes | None) – Secret used to authenticate table continuation tokens.
- Returns:
Configured serving application.
- Return type:
- httk.serve.web.api.serve(srcdir, *, host='127.0.0.1', port=8080, baseurl=None, compatibility_mode=False, config_name='config', debug=False, table_token_secret=None)[source]¶
Run a development server for a site source directory.
- Parameters:
srcdir (str | pathlib.Path) – Site source directory.
host (str) – Interface on which to listen.
port (int) – TCP port on which to listen.
baseurl (str | None) – Optional site base URL used when building links.
compatibility_mode (bool) – Whether to use legacy site conventions.
config_name (str) – Configuration module name.
debug (bool) – Whether to enable Starlette debug responses.
table_token_secret (str | bytes | None) – Secret used to authenticate table continuation tokens.
- httk.serve.web.api.publish(srcdir, outdir, baseurl, *, host_static=None, compatibility_mode=False, config_name='config', use_urls_without_ext=None)[source]¶
Render a site source directory into static output files.
- Parameters:
srcdir (str | pathlib.Path) – Site source directory.
outdir (str | pathlib.Path) – Destination directory for published files.
baseurl (str) – Site base URL used when building links.
host_static (str | None) – Optional host URL for static assets.
compatibility_mode (bool) – Whether to use legacy site conventions.
config_name (str) – Configuration module name.
use_urls_without_ext (bool | None) – Whether published page links omit extensions.
- Returns:
Report of files written and rendering warnings.
- Return type: