Для работы с mongodb накопал следующий код
from flask import Flask
from flask.ext.pymongo import PyMongo
from pymongo import Connection
connection = Connection()
db = connection.test_database
collection = db.test_collection
app = Flask(__name__)
mongo = PyMongo(app)
@app.route("/")
def hello():
return "Hello World!"
if __name__ == "__main__":
app.run()
но при запуске пайчарм выводит мне такие ошибки:
/usr/bin/python2.7 /home/user/djcode/mybg/mybg.py
Traceback (most recent call last):
File "/home/user/djcode/mybg/mybg.py", line 5, in <module>
connection = Connection()
File "/usr/local/lib/python2.7/dist-packages/pymongo/connection.py", line 220, in __init__
max_pool_size, document_class, tz_aware, _connect, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pymongo/mongo_client.py", line 336, in __init__
raise ConnectionFailure(str(e))
pymongo.errors.ConnectionFailure: could not connect to localhost:27017: [Errno 111] Connection refused
Process finished with exit code 1
Подскажите, пожалуйста, что делать и как исправить?