closeio / flask-mongorest

Restful API framework wrapped around MongoEngine
Other
522 stars 87 forks source link

Support lazy initialization / use init_app #81

Closed wojcikstefan closed 2 years ago

wojcikstefan commented 8 years ago

Thus making us more consistent with the approach recommended at http://flask.pocoo.org/docs/0.10/extensiondev/#the-extension-code

We should be able to enable the API in two ways:

  1. MongoRest(app) (already supported).
  2. api = Mongorest() -> app creation (e.g. app = create_app('the-config.cfg')) -> api.init_app(app).

In the 1st case, MongoRest's __init__ should call init_app.

See https://github.com/closeio/flask-mongorest/pull/55 for a proposed solution that unfortunately never made it to the master.

frankV commented 8 years ago

Let's get this done. I commented in #55 that I'd like to work at getting it merged