#14264 closed Bug (fixed)
settings.configure has undocumented differences from using a settings module
Reported by: | Carl Meyer | Owned by: | Gary Wilson |
---|---|---|---|
Component: | Core (Other) | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | metzen@… | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
Calling django.conf.settings.configure bypasses the Settings class in that module entirely (in favor of UserSettingsHolder), thereby bypassing all of Settings.init. This makes it subtly but occasionally critically different: globs in INSTALLED_APPS are not processed, the os.environ timezone is not set, and there is no friendly string-conversion-to-tuple for settings like TEMPLATE_DIRS.
Not setting os.environ timezone is documented and correct: settings.configure implies that you are in control of your environment and may be using Django as a piece of a larger system, Django should not go messing with the environment.
The other two differences are oversights and should be fixed.
Attachments (3)
Change History (13)
comment:1 by , 14 years ago
Summary: | settings.configure not equivalent to using a settings module → settings.configure has undocumented differences from using a settings module |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 14 years ago
Severity: | → Normal |
---|---|
Type: | → Bug |
comment:3 by , 13 years ago
Easy pickings: | unset |
---|---|
Owner: | changed from | to
Status: | new → assigned |
UI/UX: | unset |
by , 13 years ago
Attachment: | 14264.diff added |
---|
comment:4 by , 13 years ago
Has patch: | set |
---|
A patch that refactors the Settings classes a bit, gets rid of the need for a BaseSettings class, and makes it so that the UserSettingsHolder class uses the same code paths for some post-processing of settings.
by , 13 years ago
Attachment: | 14264.2.diff added |
---|
comment:5 by , 13 years ago
Patch needs improvement: | set |
---|
Please don't call the method initialize
but load
(or similar), the ambiguity to __init__
is odd. Other than that this looks good to me.
by , 12 years ago
Attachment: | 14264.3.diff added |
---|
comment:6 by , 12 years ago
Both the INSTALLED_APPS
globs and string-to-tuple conversion have been deprecated, but calling configure()
now also doesn't properly initialize the logging configuration from the settings LOGGING
and LOGGING_CONFIG
values. This can be fixed with a simple patch, which I've attached.
comment:7 by , 12 years ago
Cc: | added |
---|
comment:8 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Correcting summary and marking Accepted per discussion with Malcolm at sprint.