Support an additional variable MY_APP_USE_OTHER_CONSTANT (MY and MY_APP, are, I hope, not the prefixes you are actually using), which defaults to False and which the project settings file can override to True.
On Fri, Jun 29, 2012 at 9:06 AM, Marc Aymerich <glicer...@gmail.com> wrote: > On Fri, Jun 29, 2012 at 11:08 AM, Thomas Rega <t...@pyt3ch.com> wrote: >> Am 28.06.12 17:30, schrieb Marc Aymerich: >> >>> Hi, >>> I'm developing a reusable application and I'm having troubles with >>> constant values on settings. >>> >>> Imagine that the reusable application comes with the following settings.py >>> >>> # MY_APP/settings.py >>> from django.conf import settings >>> MY_CONSTANT = 'C1' >>> MY_OTHER_CONSTANT = 'C2' >>> MY_SETTING = getattr(settings, 'MY_SETTING', CONSTANT) >>> >>> >>> But for your project you want to override the default value of >>> MY_SETTING by MY_OTHER_CONSTANT. So you edit your project settings.py >>> and adds these two lines: >>> >>> # Project settings.py >>> .... >>> from MY_APP.settings import settings as my_app_settings >>> MY_SETTING = my_app_settings.MY_OTHER_SETTING >>> >>> >>> But this is going to fail because of the import order. >>> >>> Is there any consistent way to handle this situation? >>> >>> Thanks! >> >> Hi, >> >> what about the idea to overwrite these values via a 'local_settings.py' >> file? >> >> An example can be found here: >> https://bitbucket.org/chris1610/satchmo/src/1255b19295c7/satchmo/projects/skeleton/settings.py > > Hi thomas, thanks :) > > Yeah, actually I'm using a local_settings.py file, but at the end it > will be the same as using settings.py since local_settings.py is > imported by settings.py. :( > > > -- > Marc > > -- > 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+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.