1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-27 09:25:10 +03:00

Settings updates to support production installation.

This commit is contained in:
Chris Church 2013-05-21 09:10:48 -04:00
parent c6e32cde35
commit 7809e94fde
11 changed files with 114 additions and 61 deletions

View File

@ -13,8 +13,8 @@
tasks:
- name: remove python-dateutils package if installed
yum: name=python-dateutils15 state=removed
- name: remove python-dateutil package if installed
yum: name=python-dateutil15 state=removed
- name: install packages from yum
yum: name=$item state=installed

View File

@ -17,7 +17,7 @@
# along with Ansible Commander. If not, see <http://www.gnu.org/licenses/>.
from defaults import *
from development import *
ADMINS = (
# ('Your Name', 'your_email@domain.com'),

View File

@ -1,19 +1,5 @@
# Copyright (c) 2013 AnsibleWorks, Inc.
#
# This file is part of Ansible Commander.
#
# Ansible Commander is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# Ansible Commander is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible Commander. If not, see <http://www.gnu.org/licenses/>.
# All Rights Reserved.
__version__ = '1.2-b1'
@ -23,9 +9,11 @@ import sys
__all__ = ['__version__']
def manage():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'lib.settings')
# Default to production mode unless being called from manage.py, which sets
# the environment variable for development mode instead.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'lib.settings.production')
from django.core.management import execute_from_command_line
if len(sys.argv) >= 2 and sys.argv[1] in ('version', '--version'):
sys.stdout.write('acom-%s\n' % __version__)
sys.stdout.write('ansibleworks-%s\n' % __version__)
else:
execute_from_command_line(sys.argv)

View File

@ -31,9 +31,8 @@ def run_command_as_script(command_name):
'''
# The DJANGO_SETTINGS_MODULE environment variable should already be set if
# the script is called from a celery task.
settings_module_name = os.environ.setdefault('DJANGO_SETTINGS_MODULE',
'lib.settings')
# the script is called from a celery task. Don't attemtp to set a default.
settings_module_name = os.environ['DJANGO_SETTINGS_MODULE']
# This sys.path hack is needed when a celery task calls ansible-playbook
# and needs to execute the script directly. FIXME: Figure out if this will
# work when installed in a production environment.

View File

@ -1,20 +0,0 @@
# Copyright (c) 2013 AnsibleWorks, Inc.
#
# This file is part of Ansible Commander.
#
# Ansible Commander is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# Ansible Commander is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible Commander. If not, see <http://www.gnu.org/licenses/>.
try:
from local_settings import *
except ImportError:
from defaults import *

View File

@ -1,19 +1,5 @@
# Copyright (c) 2013 AnsibleWorks, Inc.
#
# This file is part of Ansible Commander.
#
# Ansible Commander is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# Ansible Commander is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible Commander. If not, see <http://www.gnu.org/licenses/>.
# All Rights Reserved.
import os
import sys
@ -88,7 +74,9 @@ STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
)
STATIC_ROOT = os.path.join(BASE_DIR, 'public', 'static') # FIXME: Is this where we want it?
# Absolute filesystem path to the directory where static file are collected via
# the collectstatic command.
STATIC_ROOT = os.path.join(BASE_DIR, 'public', 'static')
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/dev/howto/static-files/
@ -156,6 +144,34 @@ INSTALLED_APPS = (
INTERNAL_IPS = ('127.0.0.1',)
# Email address that error messages come from.
SERVER_EMAIL = 'root@localhost'
# Default email address to use for various automated correspondence from
# the site managers.
DEFAULT_FROM_EMAIL = 'webmaster@localhost'
# Subject-line prefix for email messages send with django.core.mail.mail_admins
# or ...mail_managers. Make sure to include the trailing space.
EMAIL_SUBJECT_PREFIX = '[AnsibleWorks] '
# The email backend to use. For possible shortcuts see django.core.mail.
# The default is to use the SMTP backend.
# Third-party backends can be specified by providing a Python path
# to a module that defines an EmailBackend class.
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
# Host for sending email.
EMAIL_HOST = 'localhost'
# Port for sending email.
EMAIL_PORT = 25
# Optional SMTP authentication information for EMAIL_HOST.
EMAIL_HOST_USER = ''
EMAIL_HOST_PASSWORD = ''
EMAIL_USE_TLS = False
# Use Django-devserver if installed.
try:
import devserver

View File

@ -0,0 +1,26 @@
# Copyright (c) 2013 AnsibleWorks, Inc.
# All Rights Reserved.
# Development settings for Ansible Commander project.
from defaults import *
# If a local_settings.py file is present here, use it and ignore the global
# settings. Normally local settings would only be present during development.
try:
local_settings_file = os.path.join(os.path.dirname(__file__),
'local_settings.py')
execfile(local_settings_file)
# Hack so that the autoreload will detect changes to local_settings.py.
class dummymodule(str):
__file__ = property(lambda self: self)
sys.modules['local_settings'] = dummymodule(local_settings_file)
except IOError:
# Otherwise, rely on the global settings file specified in the environment,
# defaulting to /etc/ansibleworks/settings.py.
try:
settings_file = os.environ.get('ANSIBLEWORKS_SETTINGS_FILE',
'/etc/ansibleworks/settings.py')
execfile(settings_file)
except IOError:
pass

View File

@ -0,0 +1,39 @@
# Copyright (c) 2013 AnsibleWorks, Inc.
# All Rights Reserved.
# Production settings for Ansible Commander project.
from defaults import *
DEBUG = False
TEMPLATE_DEBUG = DEBUG
# Clear database settings to force production environment to define them.
DATABASES = {}
# Clear the secret key to force production environment to define it.
SECRET_KEY = None
# Hosts/domain names that are valid for this site; required if DEBUG is False
# See https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
ALLOWED_HOSTS = []
# If a local_settings.py file is present here, use it and ignore the global
# settings. Normally, local settings would only be present during development.
try:
local_settings_file = os.path.join(os.path.dirname(__file__),
'local_settings.py')
execfile(local_settings_file)
# Hack so that the autoreload will detect changes to local_settings.py.
class dummymodule(str):
__file__ = property(lambda self: self)
sys.modules['local_settings'] = dummymodule(local_settings_file)
except IOError:
# Otherwise, rely on the global settings file specified in the environment,
# defaulting to /etc/ansibleworks/settings.py.
try:
settings_file = os.environ.get('ANSIBLEWORKS_SETTINGS_FILE',
'/etc/ansibleworks/settings.py')
execfile(settings_file)
except IOError:
pass

View File

@ -25,7 +25,7 @@ https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/
import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'lib.settings')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'lib.settings.production')
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

View File

@ -1,5 +1,10 @@
#!/usr/bin/env python
import os
if __name__ == '__main__':
# Since this manage.py will only be used when running from a source
# checkout, default to using the development settings.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'lib.settings.development')
from lib import manage
manage()

View File

@ -7,7 +7,7 @@ ipython==0.13.1
pexpect==2.4
# psycopg2==2.4.6
python-dateutil==1.5
PyYAML==3.10
# PyYAML==3.10
South==0.7.6
requests
djangorestframework