production_server
production_server ¶
Production server for trendify dashboards.
This module provides functions to run Dash applications in a production environment using the Waitress WSGI server.
run_production_server ¶
run_production_server(
app_or_collection: Union[Dash, DataProductCollection],
host: str = "0.0.0.0",
port: int = 8000,
title: str = "Trendify Dashboard",
debug: bool = False,
) -> None
Run a Dash application using a production WSGI server (Waitress).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
app_or_collection
|
Union[Dash, DataProductCollection]
|
Either a Dash application or a DataProductCollection |
required |
host
|
str
|
Host address to listen on |
'0.0.0.0'
|
port
|
int
|
Port to listen on |
8000
|
title
|
str
|
Title for the dashboard (used only if app_or_collection is a DataProductCollection) |
'Trendify Dashboard'
|
debug
|
bool
|
Enable debug mode (has no effect on Waitress but affects Dash) |
False
|
Raises:
Type | Description |
---|---|
ImportError
|
If Waitress is not installed |
Source code in src/trendify/production_server.py
serve_from_data_dir ¶
serve_from_data_dir(
data_dir: Union[str, Path],
host: str = "0.0.0.0",
port: int = 8000,
title: Optional[str] = None,
tag: Optional[str] = None,
) -> None
Serve a dashboard from a directory containing data products.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_dir
|
Union[str, Path]
|
Path to directory containing data products |
required |
host
|
str
|
Host address to listen on |
'0.0.0.0'
|
port
|
int
|
Port to listen on |
8000
|
title
|
Optional[str]
|
Optional title for the dashboard. If None, will use the directory name |
None
|
tag
|
Optional[str]
|
Optional tag to filter data products by |
None
|