Spaces:
Runtime error
Runtime error
Download reports/database.py from subhandev1/webmentai: direct link, hf CLI and curl.
- Browser
- Download file 344 Bytes
-
https://huggingface.co/spaces/subhandev1/webmentai/resolve/main/reports/database.py
- Command line
-
hf download hf://spaces/subhandev1/webmentai/reports/database.py
-
curl -L -o database.py https://huggingface.co/spaces/subhandev1/webmentai/resolve/main/reports/database.py
344 Bytes
| from motor.motor_asyncio import AsyncIOMotorClient | |
| from dotenv import load_dotenv | |
| import os | |
| load_dotenv() | |
| MONGO_URL = os.getenv("MONGO_URL", "mongodb+srv://localhost:27017") # Fallback to local MongoDB | |
| MONGO_DB = os.getenv("MONGO_DB", "web-maint-ai") | |
| client = AsyncIOMotorClient(MONGO_URL) | |
| db = client[MONGO_DB] | |
| def get_db(): | |
| return db |