You need to install flask-mongoengine before you can use it, e.g.,
pip install flask-mongoengine
This will install a package called flask_mongoengine
. Until you do that, Flask will have no knowledge about it. That is what causes your from flask.ext.mongoengine import MongoEngine
statement to fail.
from flask.ext import X
is a convenience inside Flask that will look for packages named flask_X
(falling back to flaskext.X
for legacy reasons). If you'd like to learn more about the specifics of the import hook used by Flask, the details are in exthook.py.