Форум сайта python.su
немогу понять как побороть вот это:
File "/usr/local/lib/python2.7/dist-packages/mongoengine/connection.py", line 95, in get_connection raise ConnectionError(msg) mongoengine.connection.ConnectionError: You have not defined a default connection
from flask.ext.mongoengine import MongoEngine db = MongoEngine() class Currencies(db.Document): # meta = {"db_alias": "currencies"} name = db.StringField(max_length=40, min_length=3) def __unicode__(self): return self.name mongo engine config in app.py:
from models import db app = Flask(__name__) app.config['MONGODB_SETTINGS'] = {'DB':'testing'} db.init_app(app)
from models import Currencies print Currencies.objects.find()
Отредактировано oleksandr.loboda (Апрель 28, 2013 16:22:34)
Офлайн
пофиксил таким образом:
app.config['MONGODB_SETTINGS'] = {'db':'testing', 'alias':'default'}
Офлайн