37 ms·
It depends how many models but usually 1 app models == 1 file (taking the app structure from django) unless they are expected to grow. For example you have a c
by Keats 11y ago
It depends how many models but usually 1 app models == 1 file (taking the app structure from django) unless they are expected to grow.
For example you have a comment app that could contain several models: Comment, Thread, Report, etc those can be in the same file. To continue on the django example, I would personally prefer having a models folder in the comments app and one file per model as some can get really big.
I also do 1 file / model in Flask, minus some specific cases where it just makes sense to have them in the same file