Skip to content

Commit

Permalink
Add support for running on Linux using gunicorn (#1333)
Browse files Browse the repository at this point in the history
This pull request adds support for running the application on Linux using gunicorn. It also updates the version number in the pyproject.toml file.
  • Loading branch information
ogabrielluiz authored Jan 14, 2024
2 parents 116bb98 + 404bbca commit 38bfa14
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "langflow"
version = "0.6.5a0"
version = "0.6.5a1"
description = "A Python package with a built-in web application"
authors = ["Logspace <[email protected]>"]
maintainers = [
Expand Down
13 changes: 8 additions & 5 deletions src/backend/langflow/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import httpx
import typer
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 print as rprint
from rich.console import Console
Expand Down Expand Up @@ -211,12 +211,15 @@ def run(
run_on_windows(host, port, log_level, options, app)
else:
# 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):
ctx = multiprocessing.get_context("spawn")
webapp_process = ctx.Process(target=run_langflow, args=(host, port, log_level, options))
def run_on_mac_or_linux(host, port, log_level, options, system, open_browser=True):
if system == "Darwin":
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()
status_code = 0
while status_code != 200:
Expand Down

0 comments on commit 38bfa14

Please sign in to comment.