Why do we need to subclass db.Model, not DeclarativeBase? #1297
Unanswered
Alan-Liang
asked this question in
Q&A
Replies: 2 comments 2 replies
-
there's absolutely nothing wrong with loading a flask application context in non-web parts of your application. in fact it's usually a good thing to do because that way you have the same environment (config etc) everywhere. |
Beta Was this translation helpful? Give feedback.
2 replies
-
I have an example here that's similar to that layout: models.py: init.py which uses app factory pattern: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The database models in our application is shared with other non-Flask components, i.e. the layout looks like this:
It is natural that I do not want to include Flask in non-web contexts (i.e. in
some_other_component
), but the models need to subclass db.Model, which is introduced by FSA. What is the recommended way to do this?Beta Was this translation helpful? Give feedback.
All reactions