Mikecode123 commited on
Commit
85227c7
·
verified ·
1 Parent(s): 4898067

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -1,8 +1,16 @@
1
  import sys
2
  from pathlib import Path
3
 
4
- REPO_ROOT = Path(__file__).resolve().parent.parent
5
- BACKEND_PATH = str(REPO_ROOT / "backend")
 
 
 
 
 
 
 
 
6
  if BACKEND_PATH not in sys.path:
7
  sys.path.insert(0, BACKEND_PATH)
8
 
 
1
  import sys
2
  from pathlib import Path
3
 
4
+
5
+ def _find_backend_path() -> Path:
6
+ current = Path(__file__).resolve().parent
7
+ for parent in [current] + list(current.parents):
8
+ candidate = parent / "backend"
9
+ if candidate.is_dir():
10
+ return candidate
11
+ raise RuntimeError("Could not find backend directory in parent paths")
12
+
13
+ BACKEND_PATH = str(_find_backend_path())
14
  if BACKEND_PATH not in sys.path:
15
  sys.path.insert(0, BACKEND_PATH)
16