summaryrefslogtreecommitdiff
path: root/django/core/management.py
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-07-14 14:47:14 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-07-14 14:47:14 +0000
commita9a04ca8f67811f3e59b9ae17ae9d639311bf6e9 (patch)
tree66ab2ffed71661639d49f468f053124ed52c7f82 /django/core/management.py
parentb8eee39e7873c888f0335bf0af6c4011550499a8 (diff)
Fixed #4731 -- Changed management.setup_environ() so that it no longer assumes
the settings module is called "settings". Patch from SmileyChris. git-svn-id: http://code.djangoproject.com/svn/django/trunk@5696 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/core/management.py')
-rw-r--r--django/core/management.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/django/core/management.py b/django/core/management.py
index 3713c3d443..0b0d356e80 100644
--- a/django/core/management.py
+++ b/django/core/management.py
@@ -1713,14 +1713,15 @@ def setup_environ(settings_mod):
# Add this project to sys.path so that it's importable in the conventional
# way. For example, if this file (manage.py) lives in a directory
# "myproject", this code would add "/path/to/myproject" to sys.path.
- project_directory = os.path.dirname(settings_mod.__file__)
+ project_directory, settings_filename = os.path.split(settings_mod.__file__)
project_name = os.path.basename(project_directory)
+ settings_name = os.path.splitext(settings_filename)[0]
sys.path.append(os.path.join(project_directory, '..'))
project_module = __import__(project_name, {}, {}, [''])
sys.path.pop()
# Set DJANGO_SETTINGS_MODULE appropriately.
- os.environ['DJANGO_SETTINGS_MODULE'] = '%s.settings' % project_name
+ os.environ['DJANGO_SETTINGS_MODULE'] = '%s.%s' % (project_name, settings_name)
return project_directory
def execute_manager(settings_mod, argv=None):