|
|
|
@ -156,11 +156,7 @@ def handle_run(args: argparse.Namespace) -> int:
|
|
|
|
ctx = require_project()
|
|
|
|
ctx = require_project()
|
|
|
|
env_name, port = parse_run_args(args.env_or_port, args.port)
|
|
|
|
env_name, port = parse_run_args(args.env_or_port, args.port)
|
|
|
|
env = {"APP_ENV": env_name}
|
|
|
|
env = {"APP_ENV": env_name}
|
|
|
|
|
|
|
|
cmd = build_run_cmd(ctx, port)
|
|
|
|
if ctx.kind == "framework":
|
|
|
|
|
|
|
|
cmd = ["uv", "run", "uvicorn", "iti.app:create_app", "--factory", "--port", port]
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
cmd = ["uv", "run", "uvicorn", "main:app", "--port", port]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if env_name == "prod":
|
|
|
|
if env_name == "prod":
|
|
|
|
cmd.extend(["--host", "0.0.0.0"])
|
|
|
|
cmd.extend(["--host", "0.0.0.0"])
|
|
|
|
@ -170,6 +166,14 @@ def handle_run(args: argparse.Namespace) -> int:
|
|
|
|
return run(cmd, ctx.root, extra_env=env)
|
|
|
|
return run(cmd, ctx.root, extra_env=env)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def build_run_cmd(ctx: ProjectContext, port: str) -> list[str]:
|
|
|
|
|
|
|
|
if ctx.kind == "framework":
|
|
|
|
|
|
|
|
cmd = ["uv", "run", "python", "-m", "uvicorn", "iti.app:create_app", "--factory", "--port", port]
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
cmd = ["uv", "run", "python", "-m", "uvicorn", "main:app", "--port", port]
|
|
|
|
|
|
|
|
return cmd
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def handle_migrate(args: argparse.Namespace) -> int:
|
|
|
|
def handle_migrate(args: argparse.Namespace) -> int:
|
|
|
|
ctx = require_project()
|
|
|
|
ctx = require_project()
|
|
|
|
action = args.action
|
|
|
|
action = args.action
|
|
|
|
|