Nikhil0987 commited on
Commit
7afc158
·
1 Parent(s): 316fa78

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -0
app.py CHANGED
@@ -3,6 +3,32 @@ from home import dashboard
3
  from streamlit_option_menu import option_menu
4
  import json
5
  import uuid
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
 
7
 
8
  # st.set_page_config(page_title="Authentication", page_icon=":guardsman:", layout="wide")
 
3
  from streamlit_option_menu import option_menu
4
  import json
5
  import uuid
6
+ import pymongo
7
+ from dotenv import load_dotenv
8
+ import os
9
+ import re
10
+
11
+
12
+ load_dotenv()
13
+
14
+ from pymongo.mongo_client import MongoClient
15
+
16
+ uri = os.environ["MONGO_CONNECTION_STRING"]
17
+
18
+ # Create a new client and connect to the server
19
+ client = MongoClient(uri)
20
+
21
+ db = client["Cosmo"]
22
+
23
+ col = db["Users"]
24
+
25
+ # Send a ping to confirm a successful connection
26
+ try:
27
+ client.admin.command('ping')
28
+ print("Pinged your deployment. You successfully connected to MongoDB!")
29
+ except Exception as e:
30
+ print(e)
31
+
32
 
33
 
34
  # st.set_page_config(page_title="Authentication", page_icon=":guardsman:", layout="wide")