Integrating Mongoengine into Pylons is really quick and painless if you know where to put stuff.
Add your DB settings to your development.ini file
mongodb.host = host[,replHost2]<br />
mongodb.port = port<br />
mongodb.db = db_name<br />
mongodb.username = uname<br />
mongodb.password = pass</p>
Connect to MongoDB in config/environment.ini
At the top, include Mongoengine
from mongoengine import connect
And at the bottom, just before we return, include the following line:
# Connect with Mongoengine<br />
connect(config['mongodb.db'], host=config['mongodb.host'], port=int(config['mongodb.port']), username=config['mongodb.username'], password=config['mongodb.password'])
Add your models
Now we can create our models just like in the Mongoengine documentation.