Issue-title: allow label-studio to be used in a bigger flask project (by exposing a blueprint) and correct the use of app_factory
Description:
Is your feature request related to a problem? Please describe.
I'd like to be able to pip install label-studio, and consume it in an existing flask app
secondly the flask app_factory pattern is implemented incorrectly as it's immediately invoked:
app = app_factory() # this call makes the app_factory pattern redundant, it should be left to "main()" or "gunicorn" to call
Describe the solution you'd like
using label_studio = Blueprint() I want to replace the @app.route calls with @label_studio.route, and move the app_factory() call into main
Describe alternatives you've considered
the "downside" of the app_factory pattern is that you can't use @app.route you have to use @some_blueprint.route instead
label-studio could opt-out of the app_factory pattern completely and therefore explicitly disallow such composition, but I think that would be a shame
Additional context
The docstring links to this URL so it seems that this pattern is desired.
Issue-title: allow label-studio to be used in a bigger flask project (by exposing a blueprint) and correct the use of app_factory Description: Is your feature request related to a problem? Please describe. I'd like to be able to pip install label-studio, and consume it in an existing flask app secondly the flask app_factory pattern is implemented incorrectly as it's immediately invoked:
https://github.com/heartexlabs/label-studio/blob/db33799ed56a3c20d54c5a486834f23e3f082d30/label_studio/server.py#L60-L76
Describe the solution you'd like using
label_studio = Blueprint()
I want to replace the@app.route
calls with@label_studio.route
, and move theapp_factory()
call into mainDescribe alternatives you've considered the "downside" of the app_factory pattern is that you can't use
@app.route
you have to use@some_blueprint.route
insteadlabel-studio could opt-out of the app_factory pattern completely and therefore explicitly disallow such composition, but I think that would be a shame
Additional context The docstring links to this URL so it seems that this pattern is desired.
https://flask.palletsprojects.com/en/1.1.x/patterns/appfactories/#basic-factories https://flask.palletsprojects.com/en/1.1.x/blueprints/#why-blueprints