On 26-03-12 02:21, Jojo wrote:
Hi guys, I'm new in Django (I started with the 1.3 and now I'm playing
with the 1.4) and I'd like to understand better the phylosophy behind
the concepts of sites and applications.
Ok a site can contain multiple applications and an application can live
in many sites, that's simple.

Now.

For me a site is like a "container" of applications and every
application accomplish a particular job just like manage polls, articles
and so on. But a site must have its own graphic style, and in particular
common parts, just like user management.

How do you handle these "trasversal" (common) components?
For example, is it possible to define a css at site level? How to deal
with user management and other commont funcionalities?

You're right, a site is a container of applications and an application should do one thing and one thing only.

Normally, you don't want your site to contain applications and at the same time have those applications inherit from your site's main template or so.


But... django sticks all the templates/ and static/ directories of all apps and sites together. So nothing stops you from sticking a very basic base template in every app ("yourapp/templates/base.html") with just a sidebar and main content block or so. You can have your apps use that.

In your site, you provide the real "yoursite/templates/base.html", which will win because your site is higher up in the INSTALLED_APPS list. Stuff that one full with the real layout and css, but keep providing the sidebar and content block (or whatever you need).


Alternative: just make templates in the apps and customize them in the site. Not as nice imho.


ALternative: start a base UI app that just provides a layout. Use that in the apps.



Reinout

--
Reinout van Rees                    http://reinout.vanrees.org/
rein...@vanrees.org             http://www.nelen-schuurmans.nl/
"If you're not sure what to do, make something. -- Paul Graham"

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@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