On Tue, Oct 13, 2009 at 10:06 PM, Doug Blank <doug.bl...@gmail.com> wrote: > I'm trying to use django without resorting to setting the environment > variable, by doing this: > > from django.conf import settings > import mysettings > settings.configure(mysettings, DEBUG=True) > > The mysettings.py originally just contained those in the default > settings.py file. > > However, I keep getting errors claiming that my module is missing > settings, such as this error: > > ... > File > "/usr/lib/python2.6/site-packages/django/utils/translation/trans_real.py", > line 194, in translation > default_translation = _fetch(settings.LANGUAGE_CODE) > File > "/usr/lib/python2.6/site-packages/django/utils/translation/trans_real.py", > line 172, in _fetch > for localepath in settings.LOCALE_PATHS: > File "/usr/lib/python2.6/site-packages/django/utils/functional.py", > line 273, in __getattr__ > return getattr(self._wrapped, name) > File "/usr/lib/python2.6/site-packages/django/conf/__init__.py", > line 130, in __getattr__ > return getattr(self.default_settings, name) > AttributeError: 'module' object has no attribute 'LOCALE_PATHS' > > I've added a bunch of settings with their defaults after I get such an > error, such as these: > > DATABASE_OPTIONS = '' > URL_VALIDATOR_USER_AGENT = '' > DEFAULT_INDEX_TABLESPACE = '' > DEFAULT_TABLESPACE = '' > CACHE_BACKEND = 'locmem://' > TRANSACTIONS_MANAGED = False > > and it will run further into some new code, until django looks up > another setting, and it isn't there. > > Everything works fine if I set the DJANGO_SETTINGS_MODULE env variable. > > I've read: > > http://docs.djangoproject.com/en/dev/ref/settings/ > > and the older version for 1.0, but they both suggest that what I'm > doing is correct. > > I'm using sqlite and Django-1.1-4.fc11.noarch under Fedora 11. > > Is this a bug, or am I doing something wrong? > > Thanks for any insight! > > -Doug >
I was able to make it through all of the tests with my sqlite backend by adding all of these default values: DATABASE_OPTIONS = '' URL_VALIDATOR_USER_AGENT = '' DEFAULT_INDEX_TABLESPACE = '' DEFAULT_TABLESPACE = '' CACHE_BACKEND = 'locmem://' TRANSACTIONS_MANAGED = False LOCALE_PATHS = tuple() But I'm wondering if I change the backend if there will be other missing values. Do people not use settings.configure()? I would think that most people would not want to have to rely on an environment variable. -Doug --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---