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
Good luck,
TR
--
Python Software Development - http://www.pyt3ch.com
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment