Thursday, December 30, 2010

Re: De-coupling settings.py from project

On Dec 30, 2010, at 8:50 AM, eblume wrote:
> Is there a way to specify settings like STATIC_URL or FIXTURES_DIRS
> per-application rather than per-site? Even better - is there a
> mechanism to use a settings.py file in the application rather than in
> the site?

I think that your overall goal is quite admirable, but this may be an optimization too far. One way to think of the way Django organizes its code is that a project is the platform on which applications are deployed. The role of settings.py (and the top-level urls.py) is to configure the applications for a particular deployment, so things like STATIC_URL that are specific to a particular deployment of the app should not be in the app itself.

Thus, the top-level settings.py should include stuff that is:

1. General across all applications, or,
2. Used to configure a particular application for a particular deployment.

All that being said, it's no big deal to emulate the urls.py include facility in settings.py; just include your app-specific settings. You can also have a 'settings.py' (or whatever) file within the application that only that app imports.

--
-- Christophe Pettus
xof@thebuild.com

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment