Author: mtredinnick
Date: 2007-07-14 09:47:14 -0500 (Sat, 14 Jul 2007)
New Revision: 5696
Modified:
django/trunk/django/core/management.py
Log:
Fixed #4731 -- Changed management.setup_environ() so that it no longer assumes
the settings module is called "settings". Patch from SmileyChris.
Modified: django/trunk/django/core/management.py
===================================================================
--- django/trunk/django/core/management.py 2007-07-14 13:39:41 UTC (rev
5695)
+++ django/trunk/django/core/management.py 2007-07-14 14:47:14 UTC (rev
5696)
@@ -1713,14 +1713,15 @@
# 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):
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---