Flask-PyMongo and init_app()
Question: I'm doing a clean-up of my development environment. I have code that was
running fine, but I wanted to remove any conflict between the various mongo
drivers. However now I'm perplexed by the error generated from the following
set-up

    
    
    <app.py>
    
    from database import mongo
    
    app = Flask(__name__)
    app.config.from_object('config')
    mongo.init_app(app)
    

and `<database.py>`

    
    
    from flask.ext.pymongo import PyMongo
    mongo = PyMongo() 
    

gives the following error:

    
    
      mongo.init_app(app)
      File "/home/x/venv/local/lib/python2.7/site-packages/flask_pymongo/__init__.py", line 232, in init_app
        cx = connection_cls(*args, **kwargs)
      File "/home/x/venv/local/lib/python2.7/site-packages/pymongo/mongo_client.py", line 342, in __init__
        for k, v in keyword_opts.items())
      File "/home/x/venv/local/lib/python2.7/site-packages/pymongo/mongo_client.py", line 342, in <genexpr>
        for k, v in keyword_opts.items())
      File "/home/x/venv/local/lib/python2.7/site-packages/pymongo/common.py", line 465, in validate
        value = validator(option, value)
      File "/home/x/venv/local/lib/python2.7/site-packages/pymongo/common.py", line 107, in raise_config_error
        raise ConfigurationError("Unknown option %s" % (key,))
    pymongo.errors.ConfigurationError: Unknown option auto_start_request
    

in my requirements.txt I have: `Flask-PyMongo==0.3.1`


Answer: You are probably using `PyMongo<3.0` version.

`auto_start_request` client method [was
removed](https://github.com/mongodb/mongo-python-
driver/blob/22fd629968527edcacf08322df60a4bf92572f65/doc/changelog.rst#changes-
in-version-30) in 3.0 release and changes added to `Flask-PyMongo==0.4.1`.

So you should either upgrade `Flask-PyMongo` or downgrade `PyMongo` package.

