Skip to content

Commit 7dfce2a

Browse files
committed
Run external servers with sys.executable -m
This ensures that if the environment path is not correct, we should still be able to resolve the granian, gunicorn, and uvicorn modules when executing the server in a subprocess.
1 parent be43052 commit 7dfce2a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

reflex/utils/exec.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,8 @@ def run_uvicorn_backend_prod(host: str, port: int, loglevel: LogLevel):
612612

613613
if constants.IS_WINDOWS:
614614
command = [
615+
sys.executable,
616+
"-m",
615617
"uvicorn",
616618
*("--host", host),
617619
*("--port", str(port)),
@@ -627,6 +629,8 @@ def run_uvicorn_backend_prod(host: str, port: int, loglevel: LogLevel):
627629

628630
# Our default args, then env args (env args win on conflicts)
629631
command = [
632+
sys.executable,
633+
"-m",
630634
"gunicorn",
631635
"--preload",
632636
*("--worker-class", "uvicorn.workers.UvicornH11Worker"),
@@ -663,6 +667,8 @@ def run_granian_backend_prod(host: str, port: int, loglevel: LogLevel):
663667
from reflex.utils import processes
664668

665669
command = [
670+
sys.executable,
671+
"-m",
666672
"granian",
667673
*("--log-level", "critical"),
668674
*("--host", host),

0 commit comments

Comments
 (0)