This was the initial question:

On Feb 26, 8:11 am, Jared Forsyth <ja...@jaredforsyth.com> wrote:
> I have been looking around for a way of managing user-configurable
> application settings

In this discussion we must IMHO different between "low-level
settings",  "admin configurable settings" and "user configurable
settings":

1. low level setting
- configuration that is needed to start up the project
- Stored in settings.py
- e.g.: database connection data

2. Admin configurable settings
- project wide configuration
-  e.g.: "min. search term length", "min. time out between login"

2. User configurable settings
- User specific configuration
- e.g.:  "Your preferred markup", "Your preferred JavaScript Editor"

Admin- and user settings are not needed at start up, so they can be
stored into the database. It should be possible to change them in a
nice way, with validation.
In my django-dbpreferences [1] app, the settings are organized with a
form.


A other problem with the current settings.py in django is the
namespace.
IMHO every app should have this own namespace. To handle variable name
conflicts i organized it in this way:

Every app had this own settings file, e.g: .../FooApp/Foo_settings.py
----------------------------------------------------
VAR1 = "Bar"
VAR2 = 123
----------------------------------------------------


In the global project settings, i do this:
----------------------------------------------------
...
# Bind the FooApp settings to the name FOO
from FooApp import Foo_settings as FOO
try:
    # User can overwrite everything in his separated settings file
    from local_settings import *
except ImportError:
    pass
----------------------------------------------------


To access the settings, e.g.:
----------------------------------------------------
from django.conf import settings

def foobar_view(request):
    var1 = settings.FOO.VAR1
    var2 = settings.FOO.VAR2
    ...
----------------------------------------------------

[1] http://code.google.com/p/django-dbpreferences/


Mfg.

Jens

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

Reply via email to