Ticket #9751: 9751-core_management_init-r10599.diff
File 9751-core_management_init-r10599.diff, 1.6 KB (added by , 16 years ago) |
---|
-
django/core/management/__init__.py
105 105 # Find the project directory 106 106 try: 107 107 from django.conf import settings 108 module = import_module(settings.SETTINGS_MODULE.split('.', 1)[0]) 109 project_directory = setup_environ(module, 110 settings.SETTINGS_MODULE) 111 except (AttributeError, EnvironmentError, ImportError): 108 module = sys.modules[settings.SETTINGS_MODULE] 109 project_directory = setup_environ(module, settings.SETTINGS_MODULE) 110 except (AttributeError, EnvironmentError, ImportError, KeyError): 112 111 project_directory = None 113 112 114 113 # Find and load the management module for each installed app. … … 316 315 # Add this project to sys.path so that it's importable in the conventional 317 316 # way. For example, if this file (manage.py) lives in a directory 318 317 # "myproject", this code would add "/path/to/myproject" to sys.path. 319 project_directory, settings_filename = os.path.split(settings_mod.__file__) 318 if '__init__.py' in settings_mod.__file__: 319 p = os.path.dirname(settings_mod.__file__) 320 else: 321 p = settings_mod.__file__ 322 project_directory, settings_filename = os.path.split(p) 320 323 if project_directory == os.curdir or not project_directory: 321 324 project_directory = os.getcwd() 322 325 project_name = os.path.basename(project_directory)