4 ms·
Not the author, but I no not understand the desire to use multiple apps. I am never going to want to carve one out as a separate module I re-use in another prod
by 3eb7988a1663 2mo ago
Not the author, but I no not understand the desire to use multiple apps. I am never going to want to carve one out as a separate module I re-use in another product. It is all interconnected, why add arbitrary boundaries separating them? Put everything into a "core" app and move on with life. Maybe if you are an enormous organization working on Instagram where you have rigid responsibilities per team.
- trojans1290 2mo agoSo you’d prefer one file with all models? Do you break out into apps for business logic? Keep models in one app/file. Then domain driven design elsewhere?
- pdhborges 2mo agoYou don't have to put all your modules into a single file. You can break them into multiple files and the import them into a model file just so that Django loads it from the expected location. Instead of apps you can just split your components inside a single app using regular python modules.
- 3eb7988a1663 2mo agoAs things get more complicated, I will separate out by some kind of concept. Which can be something as simple as: /coreapp /forms_foo.py /forms_bar.py /models_bar.py /models_foo.py /views_bar.py /views_foo.py You can do a more sophisticated module layout, but essentially something as straightforward as the above, all under a single "core" application. Prevents Django from fighting you when you want to work across the arbitrary "app" boundary.
- selcuka 2mo agoYou can also have a /models/ package with foo.py, bar.py under it. It is easier to maintain. As an additional bonus, you can add an __init__.py that imports all models if you want to be able to do a `from .models import FooModel`.