mirror of
https://github.com/ansible/awx.git
synced 2026-03-07 11:41:08 -03:30
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:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user