Run development web-server via FastAPI.
Source code in saritasa_invocations/fastapi.py
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 | @invoke.task
def run(context: invoke.Context) -> None:
"""Run development web-server via FastAPI."""
docker.up(context)
printing.print_success("Running web app")
config = _config.Config.from_context(context)
command_template = (
"{uvicorn_command} {app} --host {host} --port {port} {params}"
)
python.run(
context,
docker_params=config.fastapi.docker_params,
command=command_template.format(
uvicorn_command=config.fastapi.uvicorn_command,
app=config.fastapi.app,
host=config.fastapi.host,
port=config.fastapi.port,
params=config.fastapi.params,
),
)
|