On 18 nov, 16:43, mdnesvold <[EMAIL PROTECTED]> wrote:
> On Nov 18, 2:15 am, bruno desthuilliers
>
> <[EMAIL PROTECTED]> wrote:
> > What I usually do is to provide default values in the relevant app's
> > module(s), ie:
>
> > # myapp.models.py
> > from django.conf import settings
> > MYAPP_FOO = getattr(settings, "MYAPP_FOO", "default_foo")
>
> > # etc...
>
> The problem with using getattr(settings, 'MY_SETTING', default) is
> that I'd have to specify the default value every time I access the
> value;

Nope. You just do this once at the top of the module using these
settings, and then only use the module-level (pseudo)constant. And if
you have more than one module  depending on this setting, you just put
all these (pseudo)constants definitions in a separate package-wide
setting file that you import where needed.


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to