Ticket #4731: setup_environ.patch
File setup_environ.patch, 1.1 KB (added by , 17 years ago) |
---|
-
django/core/management.py
1644 1644 # Add this project to sys.path so that it's importable in the conventional 1645 1645 # way. For example, if this file (manage.py) lives in a directory 1646 1646 # "myproject", this code would add "/path/to/myproject" to sys.path. 1647 project_directory = os.path.dirname(settings_mod.__file__)1647 project_directory, settings_filename = os.path.split(settings_mod.__file__) 1648 1648 project_name = os.path.basename(project_directory) 1649 settings_name = os.path.splitext(settings_filename)[0] 1649 1650 sys.path.append(os.path.join(project_directory, '..')) 1650 1651 project_module = __import__(project_name, {}, {}, ['']) 1651 1652 sys.path.pop() 1652 1653 1653 1654 # Set DJANGO_SETTINGS_MODULE appropriately. 1654 os.environ['DJANGO_SETTINGS_MODULE'] = '%s. settings' % project_name1655 os.environ['DJANGO_SETTINGS_MODULE'] = '%s.%s' % (project_name, settings_name) 1655 1656 return project_directory 1656 1657 1657 1658 def execute_manager(settings_mod, argv=None):