DFS_Portfolio_Manager / database.py
James McCool
moving the slate designation out of the database_queries
9b97a5a
raw
history blame
519 Bytes
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)
nfl_db = client["NFL_Database"]
salaries_db = client['Contest_Information']
return nfl_db, salaries_db
nfl_db, salaries_db = init_conn()