Spaces:
Runtime error
Runtime error
Commit ·
6be4de2
1
Parent(s): 2f1bd8b
Whitelist IP
Browse files- app/__pycache__/main.cpython-310.pyc +0 -0
- app/main.py +12 -12
app/__pycache__/main.cpython-310.pyc
CHANGED
|
Binary files a/app/__pycache__/main.cpython-310.pyc and b/app/__pycache__/main.cpython-310.pyc differ
|
|
|
app/main.py
CHANGED
|
@@ -39,20 +39,20 @@ if not mongodb_uri or not db_name:
|
|
| 39 |
logger.error("Environment variables mongodb_uri or DB_NAME are not set.")
|
| 40 |
raise ValueError("Environment variables mongodb_uri or DB_NAME are not set.")
|
| 41 |
|
| 42 |
-
@asynccontextmanager
|
| 43 |
-
async def lifespan(app: FastAPI):
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
|
| 55 |
-
app = FastAPI(
|
| 56 |
app.add_middleware(
|
| 57 |
CORSMiddleware,
|
| 58 |
allow_origins=["*"],
|
|
|
|
| 39 |
logger.error("Environment variables mongodb_uri or DB_NAME are not set.")
|
| 40 |
raise ValueError("Environment variables mongodb_uri or DB_NAME are not set.")
|
| 41 |
|
| 42 |
+
# @asynccontextmanager
|
| 43 |
+
# async def lifespan(app: FastAPI):
|
| 44 |
+
# app.mongodb_client = MongoClient(mongodb_uri)
|
| 45 |
+
# app.database = app.mongodb_client[db_name]
|
| 46 |
+
# logger.info("Connected to the MongoDB database!")
|
| 47 |
|
| 48 |
+
# try:
|
| 49 |
+
# collections = app.database.list_collection_names()
|
| 50 |
+
# print(f"Collections in {db_name}: {collections}")
|
| 51 |
+
# yield
|
| 52 |
+
# except Exception as e:
|
| 53 |
+
# logger.error(e)
|
| 54 |
|
| 55 |
+
app = FastAPI()
|
| 56 |
app.add_middleware(
|
| 57 |
CORSMiddleware,
|
| 58 |
allow_origins=["*"],
|