nagasurendra commited on
Commit
3ad592f
·
verified ·
1 Parent(s): 7deb146

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -10
app.py CHANGED
@@ -1,19 +1,28 @@
1
  import os
2
  import sys
3
 
4
- # Add the root directory to Python's module search path
5
- project_root = os.path.dirname(os.path.abspath(__file__))
 
 
6
 
7
- if project_root not in sys.path:
8
- sys.path.insert(0, project_root)
9
 
10
- print("DEBUG: sys.path = ", sys.path) # Debugging: Print Python's module search path
 
 
11
 
12
- # Import modules from routes and utils
13
- from routes.auth import login, sign_up
14
- from routes.menu import load_menu
15
- from routes.orders import add_to_order, view_order, place_order
16
- from utils.file_initializer import initialize_files
 
 
 
 
 
17
 
18
  # Initialize necessary files
19
  initialize_files()
 
1
  import os
2
  import sys
3
 
4
+ # Add the current working directory explicitly to the Python path
5
+ current_dir = os.path.dirname(os.path.abspath(__file__))
6
+ if current_dir not in sys.path:
7
+ sys.path.insert(0, current_dir)
8
 
9
+ # Debugging: Print the module search path
10
+ print("DEBUG: sys.path =", sys.path)
11
 
12
+ # Debugging: Verify the existence of key directories and files
13
+ print("DEBUG: Does 'routes' directory exist? ", os.path.exists(os.path.join(current_dir, "routes")))
14
+ print("DEBUG: Does 'auth.py' exist in 'routes'? ", os.path.exists(os.path.join(current_dir, "routes", "auth.py")))
15
 
16
+ # Import modules
17
+ try:
18
+ from routes.auth import login, sign_up
19
+ from routes.menu import load_menu
20
+ from routes.orders import add_to_order, view_order, place_order
21
+ from utils.file_initializer import initialize_files
22
+ except ModuleNotFoundError as e:
23
+ print(f"ERROR: {e}")
24
+ print("DEBUG: ModuleNotFoundError occurred. Check the paths and file structure.")
25
+ sys.exit(1)
26
 
27
  # Initialize necessary files
28
  initialize_files()