Spaces:
Running
Running
File size: 484 Bytes
650863e aa68bcd 650863e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
import streamlit as st
import pymongo
import os
@st.cache_resource
def init_conn():
# Try to get from environment variable first, fall back to secrets
uri = os.getenv('MONGO_URI')
if not uri:
uri = st.secrets['mongo_uri']
client = pymongo.MongoClient(uri, retryWrites=True, serverSelectionTimeoutMS=500000)
db = client["NBA_Database"]
prop_db = client["Props_DB"]
return db, prop_db
db, prop_db = init_conn() |