On 3 juil, 10:19, BobAalsma <bob.aal...@aalsmacons.nl> wrote:
> Hi,
>
> I'm trying to find a (good) book or other documentation on how to
> group/organise Django files; I've found some posts on this forum, I've
> found some remarks through Google, but not a "complete" guideline for
> this subject.
>
> I have a background in software packages (3GL) and try to find answers
> to questions like:
> - when to put a bit of software in a library
> - how to organise these library files [not in the physical sense, but
> in the organisational sense]
> - how to separate / group models, views, urlconfs, etc
>
> My concern is that, if I simply put everything together, I will
> generate my own spaghetti code before my project is complete...
>
> Any suggestions?


There's no one-size-fits-all answer here. The main guideline is the
usual one - low coupling, high coherency - but that's no that helpful
from a practical POV.

A couple hints at least:

* 'low coupling' is fine, but you still *need* coupling somewhere to
turn the various parts into a coherent whole !-)
* most of the integration (=> coupling) happens in the templates
(including templatetags), then in views (and urls), and only as few as
possible in the models.


Your project will probably end up as a mix of (usually third-part)
reusable apps and (more or less) project-specific ones, and you'll
probably have to override at least parts (templates, views, forms,
urls...) of the reusable apps. Also, part of the code you'll write
will possibly be candidate for reuse so might be better factored out
of the really project-specific code (but KISS is still the rule here).

What worked for me so far was:

* one or more project-specific apps (depending on the app's
complexity) with mostly models, admin and forms, eventually a couple
templatetags.
* a "main" app with mostly views, urls, and templatetags.
* and of course the site_templates folder for all the templates.

The point here is to make the "main" app dependent on the others
(project-specific and reusable ones), not the other way round.

HTH

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to