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

@@ -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