问题描述:

I have a Flask app with several models. I've put them in a models folder like so:

models/

__init__.py

user.py

...

In each file, I've declared the Flask-SQLAlchemy equivalent on the model (class with table columns as attributes).

Now, where should I put model-related operations? Say I need to do something special before each user save; or define a much used query; or connect to third-party services.

Also, if I have some wrappers to third-party services, defined as classes, where should I put them in my app directory tree?

相关阅读:
Top