python-flask icon indicating copy to clipboard operation
python-flask copied to clipboard

Possibility to call init_app

Open denisdubovitskiy opened this issue 7 years ago • 2 comments
trafficstars

Seems like the plugin does not support deferred app initialization like other plugins do.

To avoid any cyclic imports in the app it would be great to have init_app method which takes an app as a parameter. Sometimes it's not that easy to initialize a tracer with modular layout. The documentation has no mention about the usage with flask app factory pattern.

Example

plugins.py

tracer = FlaskTracer()

app.py

from plugins import tracer

def create_app():
    app = Flask()
    tracer.init_app(app)
    return app

denisdubovitskiy avatar Sep 25 '18 14:09 denisdubovitskiy

Hey @pydrive

Thanks for the info. I will work on this item before we do the eventual release of the 1.0 version (already in the works ;) )

carlosalberto avatar Sep 25 '18 15:09 carlosalberto

Thanks for the response, @carlosalberto. I'll watch for changes in the thread!

denisdubovitskiy avatar Sep 30 '18 14:09 denisdubovitskiy