Integrating Mongoengine into Pylons is really quick and painless if you know where to put stuff.
mongodb.host = host[,replHost2]
mongodb.port = port
mongodb.db = db_name
mongodb.username = uname
mongodb.password = pass
At the top, include Mongoengine
from mongoengine import connect
And at the bottom, just before we return, include the following line:
# Connect with Mongoengine
connect(config['mongodb.db'], host=config['mongodb.host'], port=int(config['mongodb.port']), username=config['mongodb.username'], password=config['mongodb.password'])
Now we can create our models just like in the Mongoengine documentation.
This entry was posted by Mike on September 7, 2010 at 2:59 pm, and is filed under Tech. Follow any responses to this post through RSS 2.0.You can leave a response or trackback from your own site.