Fixed #8246 -- Corrected the handling of settings files. Thanks to AdamG and chrj for their parallel reports and fixes.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8323 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
d7503c5a7a
commit
05ef002048
|
@ -104,7 +104,12 @@ def get_commands():
|
||||||
# Find the project directory
|
# Find the project directory
|
||||||
try:
|
try:
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
project_directory = setup_environ(__import__(settings.SETTINGS_MODULE))
|
project_directory = setup_environ(
|
||||||
|
__import__(
|
||||||
|
settings.SETTINGS_MODULE, {}, {},
|
||||||
|
(settings.SETTINGS_MODULE.split(".")[-1],)
|
||||||
|
)
|
||||||
|
)
|
||||||
except (AttributeError, EnvironmentError, ImportError):
|
except (AttributeError, EnvironmentError, ImportError):
|
||||||
project_directory = None
|
project_directory = None
|
||||||
|
|
||||||
|
@ -310,6 +315,7 @@ def setup_environ(settings_mod):
|
||||||
|
|
||||||
# Set DJANGO_SETTINGS_MODULE appropriately.
|
# Set DJANGO_SETTINGS_MODULE appropriately.
|
||||||
os.environ['DJANGO_SETTINGS_MODULE'] = '%s.%s' % (project_name, settings_name)
|
os.environ['DJANGO_SETTINGS_MODULE'] = '%s.%s' % (project_name, settings_name)
|
||||||
|
return project_directory
|
||||||
|
|
||||||
def execute_from_command_line(argv=None):
|
def execute_from_command_line(argv=None):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue