Open Elthas17 opened 8 months ago
Hi @Elthas17,
To run connexion, you need to target the connexion app (connexion_flask_app
in your code).
To run flask-migrate, you need to target the flask app (app
or connexion_flask_app.app
in your code).
You'll probably need to return both from your factory function, or target them explicitly.
I'm not familiar with flask-migrate, so not sure what the issue with the models is, but it might be because connexion only registers the apis/blueprints and routes on the application at startup. If you can demonstrate that this is indeed the underlying issue, we can expose this functionality via a method so you can manually trigger it before startup.
@Elthas17, I am running into the same problem. Curious to know if you got it working.
Description
When i migrated to Connexion for my flask api, using the flask factory pattern, i adapted my create_app() to implement the FlaskApp from Connexion. The api runs fine, including the swagger ui.
But when i try to use flask-migrate it cant find the flask 'app' anymore.
I think it has something to do The create_app return. When i return the connexion FlaskApp , the application works and the swagger ui works. but Flask-Migrate cant find the 'app' and returns the error
When i return FlaskApp.app instead, Flask-Migrate does 'work' (migration script creator doesnt find any of the models so it wants to drop them all) , but the api / swagger ui does not work anymore.
Expected behaviour
Both connexion/swagger and flask-migrate work as intended
Actual behaviour
Flask-Migrate functionality broken
Steps to reproduce
My wsgi.py
which calls my init .py
running Flask-migrate in project root with
flask db migrate -m "testing"
returns
Additional info:
Output of the commands:
python --version
Python 3.11.6pip show connexion
Version: 3.0.5pip show flask
: Version: 3.0.0pip show flask-migrate
: Version: 4.0.5