eshan6704 commited on
Commit
aba9f5d
·
verified ·
1 Parent(s): 9bb6701

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -12
app.py CHANGED
@@ -4,20 +4,17 @@ from pydantic import BaseModel
4
  import os
5
  import importlib
6
 
7
-
8
  current_dir = os.path.dirname(os.path.abspath(__file__))
9
 
10
- # Optional: define explicit import order if needed
11
- module_order = ["common", "stock", "indices_html", "index_live_html",
12
- "preopen_html", "eq_html", "bhavcopy_html",
13
- "nsepython", "yahooinfo", "build_nse_fno"]
14
-
15
- for module_name in module_order:
16
- try:
17
- globals()[module_name] = importlib.import_module(module_name)
18
- print(f"Imported module: {module_name}")
19
- except Exception as e:
20
- print(f"Failed to import {module_name}: {e}")
21
 
22
 
23
  # ---------- FastAPI app ----------
 
4
  import os
5
  import importlib
6
 
7
+ # ---------- Auto-import all .py files in current folder ----------
8
  current_dir = os.path.dirname(os.path.abspath(__file__))
9
 
10
+ for file in os.listdir(current_dir):
11
+ if file.endswith(".py") and file not in ["app.py", "__init__.py"]:
12
+ module_name = file[:-3] # remove '.py'
13
+ try:
14
+ globals()[module_name] = importlib.import_module(module_name)
15
+ print(f"Imported module: {module_name}")
16
+ except Exception as e:
17
+ print(f"Failed to import {module_name}: {e}")
 
 
 
18
 
19
 
20
  # ---------- FastAPI app ----------