mirror of
https://github.com/ZwareBear/awx.git
synced 2026-03-20 07:43:35 -05:00
Settings updates to support production installation.
This commit is contained in:
@@ -13,8 +13,8 @@
|
|||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
|
|
||||||
- name: remove python-dateutils package if installed
|
- name: remove python-dateutil package if installed
|
||||||
yum: name=python-dateutils15 state=removed
|
yum: name=python-dateutil15 state=removed
|
||||||
|
|
||||||
- name: install packages from yum
|
- name: install packages from yum
|
||||||
yum: name=$item state=installed
|
yum: name=$item state=installed
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
# along with Ansible Commander. If not, see <http://www.gnu.org/licenses/>.
|
# along with Ansible Commander. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
from defaults import *
|
from development import *
|
||||||
|
|
||||||
ADMINS = (
|
ADMINS = (
|
||||||
# ('Your Name', 'your_email@domain.com'),
|
# ('Your Name', 'your_email@domain.com'),
|
||||||
|
|||||||
@@ -1,19 +1,5 @@
|
|||||||
# Copyright (c) 2013 AnsibleWorks, Inc.
|
# Copyright (c) 2013 AnsibleWorks, Inc.
|
||||||
#
|
# All Rights Reserved.
|
||||||
# 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/>.
|
|
||||||
|
|
||||||
|
|
||||||
__version__ = '1.2-b1'
|
__version__ = '1.2-b1'
|
||||||
|
|
||||||
@@ -23,9 +9,11 @@ import sys
|
|||||||
__all__ = ['__version__']
|
__all__ = ['__version__']
|
||||||
|
|
||||||
def manage():
|
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
|
from django.core.management import execute_from_command_line
|
||||||
if len(sys.argv) >= 2 and sys.argv[1] in ('version', '--version'):
|
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:
|
else:
|
||||||
execute_from_command_line(sys.argv)
|
execute_from_command_line(sys.argv)
|
||||||
|
|||||||
@@ -31,9 +31,8 @@ def run_command_as_script(command_name):
|
|||||||
|
|
||||||
'''
|
'''
|
||||||
# The DJANGO_SETTINGS_MODULE environment variable should already be set if
|
# The DJANGO_SETTINGS_MODULE environment variable should already be set if
|
||||||
# the script is called from a celery task.
|
# the script is called from a celery task. Don't attemtp to set a default.
|
||||||
settings_module_name = os.environ.setdefault('DJANGO_SETTINGS_MODULE',
|
settings_module_name = os.environ['DJANGO_SETTINGS_MODULE']
|
||||||
'lib.settings')
|
|
||||||
# This sys.path hack is needed when a celery task calls ansible-playbook
|
# 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
|
# and needs to execute the script directly. FIXME: Figure out if this will
|
||||||
# work when installed in a production environment.
|
# work when installed in a production environment.
|
||||||
|
|||||||
@@ -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 *
|
|
||||||
|
|||||||
@@ -1,19 +1,5 @@
|
|||||||
# Copyright (c) 2013 AnsibleWorks, Inc.
|
# Copyright (c) 2013 AnsibleWorks, Inc.
|
||||||
#
|
# All Rights Reserved.
|
||||||
# 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/>.
|
|
||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
@@ -88,7 +74,9 @@ STATICFILES_DIRS = (
|
|||||||
os.path.join(BASE_DIR, 'static'),
|
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)
|
# Static files (CSS, JavaScript, Images)
|
||||||
# https://docs.djangoproject.com/en/dev/howto/static-files/
|
# https://docs.djangoproject.com/en/dev/howto/static-files/
|
||||||
@@ -156,6 +144,34 @@ INSTALLED_APPS = (
|
|||||||
|
|
||||||
INTERNAL_IPS = ('127.0.0.1',)
|
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.
|
# Use Django-devserver if installed.
|
||||||
try:
|
try:
|
||||||
import devserver
|
import devserver
|
||||||
|
|||||||
26
lib/settings/development.py
Normal file
26
lib/settings/development.py
Normal 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
|
||||||
39
lib/settings/production.py
Normal file
39
lib/settings/production.py
Normal 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
|
||||||
@@ -25,7 +25,7 @@ https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/
|
|||||||
|
|
||||||
|
|
||||||
import os
|
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
|
from django.core.wsgi import get_wsgi_application
|
||||||
application = get_wsgi_application()
|
application = get_wsgi_application()
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
if __name__ == '__main__':
|
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
|
from lib import manage
|
||||||
manage()
|
manage()
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ ipython==0.13.1
|
|||||||
pexpect==2.4
|
pexpect==2.4
|
||||||
# psycopg2==2.4.6
|
# psycopg2==2.4.6
|
||||||
python-dateutil==1.5
|
python-dateutil==1.5
|
||||||
PyYAML==3.10
|
# PyYAML==3.10
|
||||||
South==0.7.6
|
South==0.7.6
|
||||||
requests
|
requests
|
||||||
djangorestframework
|
djangorestframework
|
||||||
|
|||||||
Reference in New Issue
Block a user