Django app custom settings testing
Hi, I'm having troubles using the override_settings decorator. The thing is I'm writing an app that has it's own settings and I'm doing it with the approach of putting a settings.py file on the app folder with something like this:
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
SETTING_A = getattr(settings, 'APP_SETTING_A', False)
SETTING_B = getattr(settings, 'APP_SETTING_B', False)
if SETTING_A and not SETTING_B:
raise ImproperlyConfigured('"SETTING_A" is set to True but "SETTING_B" is missing.')
-----
Where SETTING_B should be a tuple that depends on SETTING_A (I know I didn't type check yet). Then I use the settings importing app.settings. The thing is, I believe, that the settings are loaded once and as they're outside the project settings.py, override settings doesn't have any effect.
What would you recommend?
-- You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/22xrwU84AG8J.
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.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home