Explorar o código

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

Xiaojing Chen %!s(int64=2) %!d(string=hai) anos
pai
achega
8f9b066794
Modificáronse 3 ficheiros con 6 adicións e 1 borrados
  1. 3 0
      pynecone/config.py
  2. 2 0
      pynecone/constants.py
  3. 1 1
      pynecone/pc.py

+ 3 - 0
pynecone/config.py

@@ -18,6 +18,9 @@ class Config(Base):
     # The frontend port.
     # The frontend port.
     port: str = constants.FRONTEND_PORT
     port: str = constants.FRONTEND_PORT
 
 
+    # The frontend port.
+    backend_port: str = constants.BACKEND_PORT
+
     # The backend API url.
     # The backend API url.
     api_url: str = constants.API_URL
     api_url: str = constants.API_URL
 
 

+ 2 - 0
pynecone/constants.py

@@ -65,6 +65,8 @@ PCVERSION_APP_FILE = os.path.join(WEB_DIR, "pynecone.json")
 # Commands to run the app.
 # Commands to run the app.
 # The frontend default port.
 # The frontend default port.
 FRONTEND_PORT = "3000"
 FRONTEND_PORT = "3000"
+# The backend default port.
+BACKEND_PORT = "8000"
 # The backend api url.
 # The backend api url.
 API_URL = "http://localhost:8000"
 API_URL = "http://localhost:8000"
 # The default path where bun is installed.
 # The default path where bun is installed.

+ 1 - 1
pynecone/pc.py

@@ -70,7 +70,7 @@ def run(
 ):
 ):
     """Run the app in the current directory."""
     """Run the app in the current directory."""
     frontend_port = utils.get_config().port if port is None else port
     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 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):
     if utils.is_process_on_port(frontend_port):