On 18 nov, 03:29, mdnesvold <[EMAIL PROTECTED]> wrote: > I'm writing an application that adds several app-specific settings. As > I'm developing, I'm just adding them to the end of my settings.py > file: > > MY_APP_FOO = 'foo' > MY_APP_BAR = ( > 'bar', > 'bam', > 'baz', > ) > # and so on > > So far, I have eleven such settings over 21 lines and expect to add > several more. I don't want to make any new users of this app cut-and- > paste a block of code into their settings.py just to get the app > working, especially since some are "advanced settings" and will rarely > be changed. Is there any way to specify default values for these > settings? That way, my app requires less work to set up and still > allows flexibility.
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... --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---