From 19945dae196c4eadd16369a2a2a9b0f37d148375 Mon Sep 17 00:00:00 2001 From: kikimor Date: Fri, 18 Sep 2026 18:56:08 +0300 Subject: [PATCH] Move dev servers to ports 8002 and 5172 Backend now runs on 8002 and the frontend dev server on 5172, with the proxy, CORS origins and the run_*.bat launchers updated to match. The launchers also activate the venv so they work from a clean shell. Co-Authored-By: Claude Opus 5 --- backend/scalesapp/settings.py | 2 +- frontend/.env.example | 3 ++- frontend/package.json | 3 ++- run_comport_reader.bat | 4 +++- run_server.bat | 6 ++++-- run_test.bat | 4 +++- 6 files changed, 15 insertions(+), 7 deletions(-) diff --git a/backend/scalesapp/settings.py b/backend/scalesapp/settings.py index ae5fca2..20c42ce 100644 --- a/backend/scalesapp/settings.py +++ b/backend/scalesapp/settings.py @@ -105,7 +105,7 @@ DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' AUTH_USER_MODEL = 'api.User' # CORS Configuration -_cors_default = 'http://localhost:3000,http://127.0.0.1:3000,http://localhost:5174,http://127.0.0.1:5174' +_cors_default = 'http://localhost:5172,http://127.0.0.1:5172,http://localhost:3000,http://127.0.0.1:3000,http://localhost:5174,http://127.0.0.1:5174' CORS_ALLOWED_ORIGINS = os.getenv('CORS_ALLOWED_ORIGINS', _cors_default).split(',') CORS_ALLOW_CREDENTIALS = True CORS_ALLOW_HEADERS = [ diff --git a/frontend/.env.example b/frontend/.env.example index 49ffa03..7953c7a 100644 --- a/frontend/.env.example +++ b/frontend/.env.example @@ -1 +1,2 @@ -REACT_APP_API_URL=http://localhost:8000 +PORT=5172 +REACT_APP_API_URL=http://localhost:8002 diff --git a/frontend/package.json b/frontend/package.json index 6867e51..9f56f1a 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -12,6 +12,7 @@ }, "scripts": { "start": "react-scripts start", + "dev": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" @@ -33,5 +34,5 @@ "last 1 safari version" ] }, - "proxy": "http://localhost:8000" + "proxy": "http://localhost:8002" } diff --git a/run_comport_reader.bat b/run_comport_reader.bat index 4b5d8dd..8e4c958 100644 --- a/run_comport_reader.bat +++ b/run_comport_reader.bat @@ -1 +1,3 @@ -python .\serial_bridge\app.py \ No newline at end of file +@echo off +call "%~dp0.venv\Scripts\activate.bat" +python "%~dp0serial_bridge\app.py" diff --git a/run_server.bat b/run_server.bat index 4a4f1f1..6520f12 100644 --- a/run_server.bat +++ b/run_server.bat @@ -1,2 +1,4 @@ -cd .\backend\ -uvicorn scalesapp.asgi:application --host 127.0.0.1 --port 8000 --reload \ No newline at end of file +@echo off +call "%~dp0.venv\Scripts\activate.bat" +cd /d "%~dp0backend" +uvicorn scalesapp.asgi:application --host 127.0.0.1 --port 8002 --reload diff --git a/run_test.bat b/run_test.bat index 7cdb167..63820ae 100644 --- a/run_test.bat +++ b/run_test.bat @@ -1 +1,3 @@ -python .\test_comport_writer\test_writer.py \ No newline at end of file +@echo off +call "%~dp0.venv\Scripts\activate.bat" +python "%~dp0test_comport_writer\test_writer.py"