MONGO_URI problem
gurditsbedi opened this issue · comments
from flask import Flask, render_template
from flask_pymongo import PyMongo
import random
app = Flask(__name__)
mongo = PyMongo(app)
app.config['MONGO_URI'] = 'mongodb://username:password@ds155819.mlab.com:55819/somedb'
@app.route('/chat/reply')
def chatReply():
a = "lorem ipsum"
a = mongo.db.Test1.count()
return (str(a))I using a mongo db at mlab. I have connected it using a flask app , it contains a collection Test1.
I have the MONGO_URI settings has shown above... but i m still getting this error.
pymongo.errors.ServerSelectionTimeoutError: localhost:27017: [Errno 111] Connection refused
Out of curiosity, what was the issue here?