From 8f9b066794f7cba51015872db890335aa653889b Mon Sep 17 00:00:00 2001 From: Xiaojing Chen Date: Tue, 28 Feb 2023 10:19:43 +0800 Subject: [PATCH] pcconfig.py supports a separate backend_port from api_url (#593) --- pynecone/config.py | 3 +++ pynecone/constants.py | 2 ++ pynecone/pc.py | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/pynecone/config.py b/pynecone/config.py index dfea09482..f0ed04969 100644 --- a/pynecone/config.py +++ b/pynecone/config.py @@ -18,6 +18,9 @@ class Config(Base): # The frontend port. port: str = constants.FRONTEND_PORT + # The frontend port. + backend_port: str = constants.BACKEND_PORT + # The backend API url. api_url: str = constants.API_URL diff --git a/pynecone/constants.py b/pynecone/constants.py index f43c029c4..a6054616b 100644 --- a/pynecone/constants.py +++ b/pynecone/constants.py @@ -65,6 +65,8 @@ PCVERSION_APP_FILE = os.path.join(WEB_DIR, "pynecone.json") # Commands to run the app. # The frontend default port. FRONTEND_PORT = "3000" +# The backend default port. +BACKEND_PORT = "8000" # The backend api url. API_URL = "http://localhost:8000" # The default path where bun is installed. diff --git a/pynecone/pc.py b/pynecone/pc.py index c22328ab2..f923359bf 100644 --- a/pynecone/pc.py +++ b/pynecone/pc.py @@ -70,7 +70,7 @@ def run( ): """Run the app in the current directory.""" frontend_port = utils.get_config().port if port is None else port - backend_port = utils.get_api_port() + backend_port = utils.get_config().backend_port # If something is running on the ports, ask the user if they want to kill or change it. if utils.is_process_on_port(frontend_port):