Spaces:
Paused
Paused
Mirrowel commited on
Commit ·
b6116f7
1
Parent(s): 352d879
refactor(startup): 🔨 reorganize import sequence to eliminate blocking dependencies
Browse files- src/proxy_app/main.py +8 -2
src/proxy_app/main.py
CHANGED
|
@@ -51,10 +51,13 @@ _start_time = time.time()
|
|
| 51 |
# Load all .env files from root folder (main .env first, then any additional *.env files)
|
| 52 |
from dotenv import load_dotenv
|
| 53 |
from glob import glob
|
| 54 |
-
from rotator_library.utils.paths import get_default_root, get_logs_dir, get_data_file
|
| 55 |
|
| 56 |
# Get the application root directory (EXE dir if frozen, else CWD)
|
| 57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
# Load main .env first
|
| 60 |
load_dotenv(_root_dir / ".env")
|
|
@@ -237,6 +240,9 @@ print(
|
|
| 237 |
# Note: Debug logging will be added after logging configuration below
|
| 238 |
|
| 239 |
# --- Logging Configuration ---
|
|
|
|
|
|
|
|
|
|
| 240 |
LOG_DIR = get_logs_dir(_root_dir)
|
| 241 |
|
| 242 |
# Configure a console handler with color (INFO and above only, no DEBUG)
|
|
|
|
| 51 |
# Load all .env files from root folder (main .env first, then any additional *.env files)
|
| 52 |
from dotenv import load_dotenv
|
| 53 |
from glob import glob
|
|
|
|
| 54 |
|
| 55 |
# Get the application root directory (EXE dir if frozen, else CWD)
|
| 56 |
+
# Inlined here to avoid triggering heavy rotator_library imports before loading screen
|
| 57 |
+
if getattr(sys, "frozen", False):
|
| 58 |
+
_root_dir = Path(sys.executable).parent
|
| 59 |
+
else:
|
| 60 |
+
_root_dir = Path.cwd()
|
| 61 |
|
| 62 |
# Load main .env first
|
| 63 |
load_dotenv(_root_dir / ".env")
|
|
|
|
| 240 |
# Note: Debug logging will be added after logging configuration below
|
| 241 |
|
| 242 |
# --- Logging Configuration ---
|
| 243 |
+
# Import path utilities here (after loading screen) to avoid triggering heavy imports early
|
| 244 |
+
from rotator_library.utils.paths import get_logs_dir, get_data_file
|
| 245 |
+
|
| 246 |
LOG_DIR = get_logs_dir(_root_dir)
|
| 247 |
|
| 248 |
# Configure a console handler with color (INFO and above only, no DEBUG)
|