Add support for running on Linux using gunicorn
This commit is contained in:
parent
116bb985d3
commit
54c40c670a
1 changed files with 8 additions and 5 deletions
|
|
@ -10,7 +10,7 @@ from typing import Optional
|
||||||
import httpx
|
import httpx
|
||||||
import typer
|
import typer
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
from multiprocess import cpu_count # type: ignore
|
from multiprocess import Process, cpu_count # type: ignore
|
||||||
from rich import box
|
from rich import box
|
||||||
from rich import print as rprint
|
from rich import print as rprint
|
||||||
from rich.console import Console
|
from rich.console import Console
|
||||||
|
|
@ -211,12 +211,15 @@ def run(
|
||||||
run_on_windows(host, port, log_level, options, app)
|
run_on_windows(host, port, log_level, options, app)
|
||||||
else:
|
else:
|
||||||
# Run using gunicorn on Linux
|
# Run using gunicorn on Linux
|
||||||
run_on_mac_or_linux(host, port, log_level, options, app, open_browser)
|
run_on_mac_or_linux(host, port, log_level, options, platform.system(), open_browser)
|
||||||
|
|
||||||
|
|
||||||
def run_on_mac_or_linux(host, port, log_level, options, app, open_browser=True):
|
def run_on_mac_or_linux(host, port, log_level, options, system, open_browser=True):
|
||||||
ctx = multiprocessing.get_context("spawn")
|
if system == "Darwin":
|
||||||
webapp_process = ctx.Process(target=run_langflow, args=(host, port, log_level, options))
|
ctx = multiprocessing.get_context("spawn")
|
||||||
|
webapp_process = ctx.Process(target=run_langflow, args=(host, port, log_level, options))
|
||||||
|
else:
|
||||||
|
webapp_process = Process(target=run_langflow, args=(host, port, log_level, options))
|
||||||
webapp_process.start()
|
webapp_process.start()
|
||||||
status_code = 0
|
status_code = 0
|
||||||
while status_code != 200:
|
while status_code != 200:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue