#19031: Using @override_settings doesn't override DATABASES in threads +SQLite
-------------------------------+------------------------------------
Reporter: jonash | Owner: joeri
Type: Bug | Status: assigned
Component: Documentation | Version: 1.4
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by joeri):
* cc: joeri (added)
* has_patch: 0 => 1
Comment:
Just added a pull request: https://github.com/django/django/pull/1095
So, {{{override_settings}}} provides a way to change settings in your
Django settings. However, some settings are only accessed during the
initialization of your project. For example, the DATABASES and CACHES
settings are read and cached by Django and Django internals only use these
cached objects (and not read your settings file over and over again).
Still, overriding the DATABASE setting with {{{override_settings}}} does
change the DATABASE setting when accessed via {{{django.conf.settings}}}.
This override however has no effect in practice. I call this unexpected
behaviour because you probably expected that your database backend
actually changed.
In addition to documenting these settings that show unexpected behaviour,
I also added a {{{UserWarning}}} when people try to change these settings.
I specifically not raise an exception because you might want to test
something not related to what Django does internally (although you
probably do).
Note that this also introduces the interesting fact that the Django test
suite shows this warning. This actually related to another ticket #20075
where this problem is described.
--
Ticket URL: <https://code.djangoproject.com/ticket/19031#comment:8>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.