jaothan commited on
Commit
b9d5fa5
·
verified ·
1 Parent(s): f4d00c3

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from pymongo import MongoClient
3
+ import os
4
+ import certifi
5
+ from pydantic import BaseModel
6
+ from typing import List
7
+
8
+
9
+ # Replace with your actual connection string
10
+ MONGO_URI = os.getenv("MONGO_URI")
11
+ # Connect to MongoDB Atlas
12
+ client = MongoClient(MONGO_URI, tls=True, tlsCAFile=certifi.where())
13
+
14
+ # Test the connection
15
+ try:
16
+ client.admin.command('ping')
17
+ print("Pinged your deployment. You successfully connected to MongoDB!")
18
+ except Exception as e:
19
+ print(f"Error: {e}")