Organization code django project, linking applications


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
5 views
Was now wondering how anyone organizes their Django projects:
create multiple applications(one for logical partitions Ala blog, contacts, news, etc.) and each separately create models and view function;
keep all code in the project root, separating logical sections by crushing the models and vyuha file and only take out the reusable code into applications;
other options;?
If the fetus is the application to organize how the interaction between them(it's not about templates, but about logic)?

Just exploring Django in practice, I implement a fairly large project, and after months of scribbling came to the conclusion that my approach is not optimal and prevents priderzhivatsya KISS and DRY, therefore very much I ask to share experience.
by | 5 views

3 Answers

0 like 0 dislike
Nice app django — uniswa, does one thing, does it well, has some external API to communicate with other modules. Usually, even in a small project there are about a dozen apps. The advantages of this approach — much easier to test, reuse of code, can be relatively painless to change the implementation of a module without disrupting the entire site.
\r
Anti-pattern — a monolithic application (usually just one or two). Them, among other things, harder to maintain, because the code performs many not directly connected tasks (functions responsible for the generation of RSS and changing user avatars, are close together in this file, nothing will be done without a pint and ctrl-F). This is especially true when the team added new developer.
\r
Application interaction — a much more extensive topic, it so easily in two sentences, not to disclose, I think.
by
0 like 0 dislike
I have not much experience with Django, but I think this is the method of crushing, and uses a separate app for every task.
And what about interaction — so that is in Python is a very flexible system imports, no?
by
0 like 0 dislike
I have a big old app to Django. Use the balance between these two approaches: most of the functionality in one big application that is split in packages of modules, such as:
— big_app
— models
— profile.py
— content.py
— events.py
— forum.py
— views
— forum.py
— event.py
\r
Part in a separate app, I don't know why, because they still may not be reused, as too tied to the specifics of the application and use of imports from the main application. But I didn't make this structure. I would probably instead would add modules to the existing large application and a separate application would only code that can be reused (so we have a little, but there).
by

Related questions

0 like 0 dislike
1 answer
asked May 12, 2019 by slavamironoff
0 like 0 dislike
3 answers
0 like 0 dislike
3 answers
0 like 0 dislike
3 answers
110,608 questions
257,186 answers
0 comments
27,389 users