Hi,
If I'm developing middleware or an app that I want a user to be able to
configure in their settings.py, how should I go about setting defaults
in there? I checked out django.conf, and it just looks like
global_settings.py registers the defaults for every possible module
included with Django.
So for my CAS module for example, I want some values available in
settings.py like CAS_SERVICE_URL and such, and these should have
defaults (even if they're None) so I can always access
settings.CAS_SERVICE_URL.
Here's how I'm doing it now:
defaults = {'CAS_POPULATE_USER': None,
'CAS_LOGIN_URL': '/accounts/login/',
'CAS_LOGOUT_URL': '/accounts/logout/',
'CAS_SERVICE_URL': None,
'CAS_REDIRECT_FIELD_NAME': 'next',
'CAS_REDIRECT_URL': '/',
}
for key, value in defaults.iteritems():
try:
getattr(settings, key)
except AttributeError:
setattr(settings, key, value)
So now if another app does 'from django.conf import settings', will
these additions be there or not? Would I have to 'from cas import
settings' instead, to get a LazySettings object with these values?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---