pcconfig.py supports a separate backend_port from api_url (#593)

This commit is contained in:
Xiaojing Chen 2023-02-28 10:19:43 +08:00 committed by GitHub
parent 387bacff73
commit 8f9b066794
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 1 deletions

View File

@ -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

View File

@ -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.

View File

@ -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):