You must specify a URI or set the MONGO_URI Flask config variable
When I try to run , I got the following error, ''' mongo = PyMongo(app) File "/usr/local/lib/python2.7/dist-packages/flask_pymongo/init.py", line 116, in init self.init_app(app, uri, *args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/flask_pymongo/init.py", line 146, in init_app "You must specify a URI or set the MONGO_URI Flask config variable", ValueError: You must specify a URI or set the MONGO_URI Flask config variable '''
Any help?
I've tried to reproduce your error by messing with my mongodb settings, but I haven't had luck. So a few questions:
- Do you have mongodb running?
- Have you modified the
default_config.pyfile? This file assumes that your mongodb server can be reached at localhost:27017 - What version of pymongo do have?
I am using anaconda and have following packages
"
Flask 1.0.2
I am using anaconda and have following packages " Flask 1.0.2 Flask-PyMongo 2.0.0 pymongo 3.7.0 " After I add " app.config["MONGO_URI"] = "mongodb://localhost:27017/visipedia_annotation_toolkit" "before mongo = PyMongo(app), then it could work. Thank you for your help!
In which file do we have to add this text? can you please tell the location of the file in Ubuntu.