Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

You must specify a URI or set the MONGO_URI Flask config variable #3

Open
HailinRen opened this issue Jul 9, 2018 · 4 comments
Open

Comments

@HailinRen
Copy link

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?

@gvanhorn38
Copy link
Contributor

I've tried to reproduce your error by messing with my mongodb settings, but I haven't had luck. So a few questions:

  1. Do you have mongodb running?
  2. Have you modified the default_config.py file? This file assumes that your mongodb server can be reached at localhost:27017
  3. What version of pymongo do have?

@HailinRen
Copy link
Author

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!

@hemangjoshi37a
Copy link

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.

@Amitpandey241
Copy link

Are you using the mongo_uri and then defining the value app.config["MONGO_URI"] =os.getenv("MONGO_URI")
if so then use dotenv and load_dotenv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants