Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#6493 closed (wontfix)

Don't clobber a set DJANGO_SETTINGS_MODULE

Reported by: Bastian Kleineidam <calvin@…> Owned by: nobody
Component: Uncategorized Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Only set the DJANGO_SETTINGS_MODULE value if it is not already set.

Attachments (1)

0029-Don-t-clobber-a-set-DJANGO_SETTINGS_MODULE.patch (992 bytes) - added by Bastian Kleineidam <calvin@…> 7 years ago.

Download all attachments as: .zip

Change History (3)

Changed 7 years ago by Bastian Kleineidam <calvin@…>

comment:1 Changed 7 years ago by mtredinnick

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to wontfix
  • Status changed from new to closed

No, this is not a good idea. The environment variable is only set for the process space of the running Python process, so it doesn't affect anything outside the current Django process (and potentially its children). However, if we're using a particular settings value, then it should always be consistent -- whether somebody accesses it via DJANGO_SETTINGS_MODULE or tries to work it out as we do in the management command.

Thus, the current code makes sure that a consistent settings value is used throughout the process, which reduces the possibility of inadvertent errors.

If you have a concrete case where this is causing a bug then, please provide some details, however, the current code is there for a reason.

comment:2 Changed 7 years ago by Bastian Kleineidam <calvin@…>

Hm, I remember dimly having some problems without the patch. I will try to reproduce them and report back.

Note: See TracTickets for help on using tickets.
Back to Top