Ticket #6493: 0029-Don-t-clobber-a-set-DJANGO_SETTINGS_MODULE.patch

File 0029-Don-t-clobber-a-set-DJANGO_SETTINGS_MODULE.patch, 992 bytes (added by Bastian Kleineidam <calvin@…>, 17 years ago)
  • django/core/management/__init__.py

    From 50e4eb3225acbb54d81f1348e1359d04a6e40fea Mon Sep 17 00:00:00 2001
    From: Bastian Kleineidam <calvin@debian.org>
    Date: Fri, 25 Jan 2008 23:01:29 +0100
    Subject: Don't clobber a set DJANGO_SETTINGS_MODULE
    
    Only set the DJANGO_SETTINGS_MODULE value if it is not already set.
    
    Signed-off-by: Bastian Kleineidam <calvin@debian.org>
    
    diff --git a/django/core/management/__init__.py b/django/core/management/__init__.py
    index d78e2ed..ea40ab8 100644
    a b def setup_environ(settings_mod):  
    252252    sys.path.pop()
    253253
    254254    # Set DJANGO_SETTINGS_MODULE appropriately.
    255     os.environ['DJANGO_SETTINGS_MODULE'] = '%s.%s' % (project_name, settings_name)
     255    if 'DJANGO_SETTINGS_MODULE' not in os.environ:
     256        os.environ['DJANGO_SETTINGS_MODULE'] = \
     257                         '%s.%s' % (project_name, settings_name)
    256258    return project_directory
    257259
    258260def execute_from_command_line(argv=None):
Back to Top