Skip to content

Commit 9d92f4c

Browse files
committed
move main.py into root folder, add uvicorn to imports
1 parent 585b940 commit 9d92f4c

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

backend/__init__.py

Whitespace-only changes.

backend/main.py renamed to main.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from decimal import Decimal
88
import os
99
from dotenv import load_dotenv
10+
import uvicorn
1011

1112
# Load environment variables from .env file
1213
load_dotenv()
@@ -23,7 +24,10 @@
2324
)
2425

2526
# Load the SQLite DB path from the environment
26-
SQLITE_DB_PATH = os.getenv("SQLITE_DB_PATH", "../defog-data/sqlite_dbs") # Default value if not in env
27+
SQLITE_DB_PATH = os.getenv(
28+
"SQLITE_DB_PATH", "../defog-data/sqlite_dbs"
29+
) # Default value if not in env
30+
2731

2832
# Enum for Database Types
2933
class DBType(str, Enum):
@@ -38,7 +42,7 @@ class DBType(str, Enum):
3842
"mysql": "mysql+mysqlconnector://root:password@localhost/",
3943
"postgres": "postgresql+psycopg2://postgres:password@localhost/",
4044
"sqlite": "sqlite:///",
41-
"tsql": "mssql+pyodbc://sa:password@localhost/{db_name}?driver=ODBC+Driver+17+for+SQL+Server"
45+
"tsql": "mssql+pyodbc://sa:password@localhost/{db_name}?driver=ODBC+Driver+17+for+SQL+Server",
4246
}
4347

4448

@@ -104,3 +108,7 @@ def execute_query(query, db_type, db_name):
104108
return result_list
105109
except SQLAlchemyError as e:
106110
return {"error": str(e)}
111+
112+
113+
if __name__ == "__main__":
114+
uvicorn.run(app, host="0.0.0.0", port=8000)

0 commit comments

Comments
 (0)