1
0
mirror of https://github.com/django/django.git synced 2025-10-26 15:16:09 +00:00

Fixed #5943 -- Modified django-admin to behave like manage.py if settings are provided, either as --settings or DJANGO_SETTINGS_MODULE. Thanks to Joseph Kocherhans and Todd O'Bryan for their work on this ticket.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8282 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Russell Keith-Magee
2008-08-10 08:42:49 +00:00
parent 7610983bb2
commit ec7d8b7c61
3 changed files with 70 additions and 69 deletions

View File

@@ -82,9 +82,14 @@ class BaseCommand(object):
# But only do this if we can assume we have a working settings file,
# because django.utils.translation requires settings.
if self.can_import_settings:
from django.utils import translation
translation.activate('en-us')
try:
from django.utils import translation
translation.activate('en-us')
except ImportError, e:
# If settings should be available, but aren't,
# raise the error and quit.
sys.stderr.write(self.style.ERROR(str('Error: %s\n' % e)))
sys.exit(1)
try:
if self.requires_model_validation:
self.validate()