.
# A very simple Flask Hello World app for you to get started with...
from flask import Flask, jsonify
from pymongo import MongoClient
client = MongoClient("mongodb+srv://<personal_details>.mongodb.net/test")
db=client.scpDatabase
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'default page'
@app.route('/<path:dummy>')
def fallback(dummy):
return jsonify(db.<personal>.find_one({'_id': <personal>}),204)
if __name__ == '__main__':
app.run()
Is the code that doesnt work when run on the virtualenv and as a web app.
from pymongo import MongoClient
#Step 1: Connect to MongoDB - Note: Change connection string as needed
client = MongoClient("mongodb+srv://<personal_details.mongodb.net/test")
db=client.scpDatabase
print(db.<personal>.find_one({'_id':<personal>}))
dict = db.<personal>.find_one({'_id':<personal>})
for x in dict['body']:
print(x)
Is the code that works when run from bash under the same virtualenv
pymongo.errors.ServerSelectionTimeoutError: No replica set members found yet
That is the error I'm receiving.
I haven't made any progress on it since yesterday, and nothing I've found has really helped. Thanks for your input but, I should have provided code.