You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi Team - Love the repo and thank you. As you can imagine, once you begin to create larger and larger applications, the number of routes, models and schemas begin to increase, and become increasingly complex. Could you refactor your code to show how you would recommend separating your Marshmallow/SQLAlchemy Models from the main Flask app/routes? Right now you're instantiating the marshmallow object (ma) inside the main app.py file and then creating Marshmallow schemas below it. When you start having dozens or more tables/models this becomes unwieldy and increases the blast radius of app.py.
Thanks!
The text was updated successfully, but these errors were encountered:
I believe the best way to show this structure would be a dedicated schemas subpackage in your project which defines the flask-marshmallow extension object. Your app factory then imports that and calls init_app.
Hi Team - Love the repo and thank you. As you can imagine, once you begin to create larger and larger applications, the number of routes, models and schemas begin to increase, and become increasingly complex. Could you refactor your code to show how you would recommend separating your Marshmallow/SQLAlchemy Models from the main Flask app/routes? Right now you're instantiating the marshmallow object (
ma
) inside the mainapp.py
file and then creating Marshmallow schemas below it. When you start having dozens or more tables/models this becomes unwieldy and increases the blast radius of app.py.Thanks!
The text was updated successfully, but these errors were encountered: