On 04/15/2011 04:20 AM, akaariai wrote: > I have been using setup_environ in my projects, and the lazy > initialization in can cause some weird problems, for example if you do > manual timing using: > start = datetime.now() > access settings > print 'Used %s' % (datetime.now() - start) > > You might get weird results as accessing settings can change your > timezone. Would it be wise that setup_environ() would access the > settings so that they are no more lazy? Or does this cause other > problems?
I think this would be worth experimenting with. AFAIK the only real reason for settings to be lazy is to avoid the dreaded "Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined." when importing modules that import settings (instead you only get it when settings are actually accessed). But that's not an issue for setup_environ, because it takes the module as parameter and actually sets DJANGO_SETTINGS_MODULE. So I don't think there would be any harm (and there would be significant predictability benefit) in having setup_environ trigger the actual loading of settings immediately. Carl -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.