From 13720422283df068f04b99bf0f9150630f1869c3 Mon Sep 17 00:00:00 2001 From: Nikhil Rao Date: Mon, 28 Aug 2023 20:32:27 -0700 Subject: [PATCH] Fix run frontend only (#1706) --- reflex/reflex.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/reflex/reflex.py b/reflex/reflex.py index 4140f764a..daf929dd5 100644 --- a/reflex/reflex.py +++ b/reflex/reflex.py @@ -170,13 +170,20 @@ def run( # Run the frontend and backend together. commands = [] + + # Run the frontend on a separate thread. if frontend: setup_frontend(Path.cwd()) commands.append((frontend_cmd, Path.cwd(), frontend_port)) + + # In prod mode, run the backend on a separate thread. if backend and env == constants.Env.PROD: commands.append((backend_cmd, backend_host, backend_port)) + + # Start the frontend and backend. with processes.run_concurrently_context(*commands): - if env == constants.Env.DEV: + # In dev mode, run the backend on the main thread. + if backend and env == constants.Env.DEV: backend_cmd(backend_host, int(backend_port))