Quantcast
Channel: Active questions tagged mongodb-atlas - Stack Overflow
Viewing all articles
Browse latest Browse all 271

Trouble when trying to connect MongoDB Atlas with Flask-Pymongo

$
0
0

I used to have a mongodb server on my computer and everything worked just fine. When I tried to deploy the server to MongoDB atlas it broke.

from flask import Flaskfrom flask_pymongo import PyMongoapp = Flask(__name__)app.config["MONGO_URI"] = "..."app.config["SECRET_KEY"] = "..."mongo = PyMongo(app)# Rest of the code

The problem is that mongo.db is None and when I'm trying to do mongo.db.users I get an error that NoneType doesn't have users attribute, but given that it used to work in the past I believe that MongoDB atlas didn't connect properly with Flask-Pymongo and that the script is correct. I setted up the Mongo cluster, created a user and password and added my ip to network access (I even tried adding 0.0.0.0/0, which allows access from everyone). I'm so confused. Can someone help me?


Viewing all articles
Browse latest Browse all 271

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>