django.conf.settings doesn't work if setattr is used before getattr
|Reported by:||Owned by:||Jacob|
|Cc:||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
If you set DJANGO_SETTINGS_MODULE manually, and then do
from django.conf import settings settings.DATABASE_NAME = 'hello'
You get an exception.
It turns out that LazySettings initializes _target only on getattr, and not on setattr.
The attached two-line patch initializes it also on setattr.
(I really encountered this bug!)
Change History (4)
comment:1 Changed 9 years ago by
|Patch needs improvement:||unset|
|Triage Stage:||Unreviewed → Ready for checkin|