Fix for django-jsonfield to work on Django 1.4.1 (default with Ubuntu 12.10, fix for AC-222), update settings to provide more information when unable to load local/global settings file.

This commit is contained in:
Chris Church
2013-07-28 16:30:19 -04:00
parent 4c2af3a879
commit 92bfddb834
4 changed files with 31 additions and 27 deletions

View File

@@ -16,5 +16,8 @@ try:
class dummymodule(str):
__file__ = property(lambda self: self)
sys.modules['local_settings'] = dummymodule(local_settings_file)
except IOError:
pass
except IOError, e:
from django.core.exceptions import ImproperlyConfigured
if os.path.exists(settings_file):
msg = 'Unable to load %s: %s' % (local_settings_file, str(e))
raise ImproperlyConfigured(msg)

View File

@@ -33,10 +33,13 @@ settings_file = os.environ.get('AWX_SETTINGS_FILE',
'/etc/awx/settings.py')
try:
execfile(settings_file)
except IOError:
except IOError, e:
from django.core.exceptions import ImproperlyConfigured
msg = 'No AWX configuration found at %s.' % settings_file
if 'AWX_SETTINGS_FILE' not in os.environ:
msg += '\nDefine the AWX_SETTINGS_FILE environment variable to specify'
msg += ' an alternate path.'
if not os.path.exists(settings_file):
msg = 'No AWX configuration found at %s.' % settings_file
if 'AWX_SETTINGS_FILE' not in os.environ:
msg += '\nDefine the AWX_SETTINGS_FILE environment variable to '
msg += 'specify an alternate path.'
else:
msg = 'Unable to load %s: %s' % (settings_file, str(e))
raise ImproperlyConfigured(msg)