vish85521 commited on
Commit
00ade16
·
verified ·
1 Parent(s): 3ae120c

Update config.py

Browse files
Files changed (1) hide show
  1. config.py +15 -10
config.py CHANGED
@@ -8,17 +8,22 @@ from functools import lru_cache
8
 
9
  # Determine .env path - check both current dir and parent dir
10
  def find_env_file():
11
- """Find .env file in current or parent directory"""
12
- current_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
13
-
 
 
 
 
 
 
14
  # Check backend directory
15
- if os.path.exists(os.path.join(current_dir, ".env")):
16
- return os.path.join(current_dir, ".env")
17
-
18
- # Check parent directory (agent-society-platform)
19
- parent_dir = os.path.dirname(current_dir)
20
- if os.path.exists(os.path.join(parent_dir, ".env")):
21
- return os.path.join(parent_dir, ".env")
22
 
23
  return ".env"
24
 
 
8
 
9
  # Determine .env path - check both current dir and parent dir
10
  def find_env_file():
11
+ """Find .env file in app, backend, or project root directory"""
12
+ app_dir = os.path.dirname(os.path.abspath(__file__))
13
+ backend_dir = os.path.dirname(app_dir)
14
+ project_root_dir = os.path.dirname(backend_dir)
15
+
16
+ # Check app directory (this folder)
17
+ if os.path.exists(os.path.join(app_dir, ".env")):
18
+ return os.path.join(app_dir, ".env")
19
+
20
  # Check backend directory
21
+ if os.path.exists(os.path.join(backend_dir, ".env")):
22
+ return os.path.join(backend_dir, ".env")
23
+
24
+ # Check project root directory
25
+ if os.path.exists(os.path.join(project_root_dir, ".env")):
26
+ return os.path.join(project_root_dir, ".env")
 
27
 
28
  return ".env"
29