Spaces:
Runtime error
Runtime error
File size: 729 Bytes
d3f54c7 4c1fe20 c7a760b 335c3b7 c7a760b 4f8d31b c7a760b 335c3b7 c7a760b d3f54c7 40637d8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
import streamlit as st
from streamlit_option_menu import option_menu
import os
from pymongo.mongo_client import MongoClient
# from pymongo.server_api import ServerApi
uri = os.environ["MONGO_CONNECTION_STRING"]
# Create a new client and connect to the server
client = MongoClient(uri, ssl=False, tls=False)
db = client["myapp"]
col = db["users"]
newuser = {
"username": "John",
"password": "sdgsg"
}
col.insert_one(newuser)
print("done!")
# Send a ping to confirm a successful connection
try:
client.admin.command('ping')
print("Pinged your deployment. You successfully connected to MongoDB!")
except Exception as e:
print(e)
option_menu(None, ["Home", "About Us", "Logout"], orientation="horizontal") |