1
# vim: tabstop=4 shiftwidth=4 softtabstop=4
3
# Copyright 2012 United States Government as represented by the
4
# Administrator of the National Aeronautics and Space Administration.
7
# Copyright 2012 Nebula, Inc.
9
# Licensed under the Apache License, Version 2.0 (the "License"); you may
10
# not use this file except in compliance with the License. You may obtain
11
# a copy of the License at
13
# http://www.apache.org/licenses/LICENSE-2.0
15
# Unless required by applicable law or agreed to in writing, software
16
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
17
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
18
# License for the specific language governing permissions and limitations
26
from openstack_dashboard import exceptions
28
warnings.formatwarning = lambda message, category, *args, **kwargs: \
29
'%s: %s' % (category.__name__, message)
31
ROOT_PATH = os.path.dirname(os.path.abspath(__file__))
32
BIN_DIR = os.path.abspath(os.path.join(ROOT_PATH, '..', 'bin'))
34
if ROOT_PATH not in sys.path:
35
sys.path.append(ROOT_PATH)
38
TEMPLATE_DEBUG = DEBUG
40
# Ensure that we always have a SECRET_KEY set, even when no local_settings.py
41
# file is present. See local_settings.py.example for full documentation on the
42
# horizon.utils.secret_key module and its use.
43
from horizon.utils import secret_key
44
LOCAL_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'local')
45
SECRET_KEY = secret_key.generate_or_read_from_file(os.path.join(LOCAL_PATH,
48
SITE_BRANDING = 'OpenStack Dashboard'
50
LOGIN_URL = '/auth/login/'
51
LOGOUT_URL = '/auth/logout/'
52
# LOGIN_REDIRECT_URL can be used as an alternative for
53
# HORIZON_CONFIG.user_home, if user_home is not set.
54
# Do not set it to '/home/', as this will cause circular redirect loop
55
LOGIN_REDIRECT_URL = '/'
57
MEDIA_ROOT = os.path.abspath(os.path.join(ROOT_PATH, '..', 'media'))
59
STATIC_ROOT = os.path.abspath(os.path.join(ROOT_PATH, '..', 'static'))
60
STATIC_URL = '/static/'
62
ROOT_URLCONF = 'openstack_dashboard.urls'
65
'dashboards': ('project', 'admin', 'settings', 'router',),
66
'default_dashboard': 'project',
67
'user_home': 'openstack_dashboard.views.get_user_home',
68
'ajax_queue_limit': 10,
71
'fade_duration': 1500,
72
'types': ['alert-success', 'alert-info']
74
'help_url': "http://docs.openstack.org",
75
'exceptions': {'recoverable': exceptions.RECOVERABLE,
76
'not_found': exceptions.NOT_FOUND,
77
'unauthorized': exceptions.UNAUTHORIZED},
80
# Set to True to allow users to upload images to glance via Horizon server.
81
# When enabled, a file form field will appear on the create image form.
82
# See documentation for deployment considerations.
83
HORIZON_IMAGES_ALLOW_UPLOAD = True
85
MIDDLEWARE_CLASSES = (
86
'django.middleware.common.CommonMiddleware',
87
'django.middleware.csrf.CsrfViewMiddleware',
88
'django.contrib.sessions.middleware.SessionMiddleware',
89
'django.contrib.auth.middleware.AuthenticationMiddleware',
90
'django.contrib.messages.middleware.MessageMiddleware',
91
'horizon.middleware.HorizonMiddleware',
92
'django.middleware.doc.XViewMiddleware',
93
'django.middleware.locale.LocaleMiddleware',
94
'django.middleware.clickjacking.XFrameOptionsMiddleware',
97
TEMPLATE_CONTEXT_PROCESSORS = (
98
'django.core.context_processors.debug',
99
'django.core.context_processors.i18n',
100
'django.core.context_processors.request',
101
'django.core.context_processors.media',
102
'django.core.context_processors.static',
103
'django.contrib.messages.context_processors.messages',
104
'horizon.context_processors.horizon',
105
'openstack_dashboard.context_processors.openstack',
109
'django.template.loaders.filesystem.Loader',
110
'django.template.loaders.app_directories.Loader',
111
'horizon.loaders.TemplateLoader'
115
os.path.join(ROOT_PATH, 'templates'),
118
STATICFILES_FINDERS = (
119
'compressor.finders.CompressorFinder',
120
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
123
COMPRESS_PRECOMPILERS = (
124
('text/less', ('lesscpy {infile}')),
127
COMPRESS_CSS_FILTERS = (
128
'compressor.filters.css_default.CssAbsoluteFilter',
131
COMPRESS_ENABLED = True
132
COMPRESS_OUTPUT_DIR = 'dashboard'
133
COMPRESS_CSS_HASHING_METHOD = 'hash'
134
COMPRESS_PARSER = 'compressor.parser.HtmlParser'
137
'openstack_dashboard',
138
'django.contrib.contenttypes',
139
'django.contrib.auth',
140
'django.contrib.sessions',
141
'django.contrib.messages',
142
'django.contrib.staticfiles',
143
'django.contrib.humanize',
146
'openstack_dashboard.dashboards.project',
147
'openstack_dashboard.dashboards.admin',
148
'openstack_dashboard.dashboards.settings',
150
'openstack_dashboard.dashboards.router',
153
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
154
AUTHENTICATION_BACKENDS = ('openstack_auth.backend.KeystoneBackend',)
155
MESSAGE_STORAGE = 'django.contrib.messages.storage.cookie.CookieStorage'
157
SESSION_ENGINE = 'django.contrib.sessions.backends.signed_cookies'
158
SESSION_COOKIE_HTTPONLY = True
159
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
160
SESSION_COOKIE_SECURE = False
161
SESSION_TIMEOUT = 1800
163
gettext_noop = lambda s: s
165
('bg', gettext_noop('Bulgarian (Bulgaria)')),
166
('cs', gettext_noop('Czech')),
167
('en', gettext_noop('English')),
168
('es', gettext_noop('Spanish')),
169
('fr', gettext_noop('French')),
170
('it', gettext_noop('Italiano')),
171
('ja', gettext_noop('Japanese')),
172
('ko', gettext_noop('Korean (Korea)')),
173
('nl', gettext_noop('Dutch (Netherlands)')),
174
('pl', gettext_noop('Polish')),
175
('pt', gettext_noop('Portuguese')),
176
('pt-br', gettext_noop('Portuguese (Brazil)')),
177
('zh-cn', gettext_noop('Simplified Chinese')),
178
('zh-tw', gettext_noop('Traditional Chinese')),
185
OPENSTACK_KEYSTONE_DEFAULT_ROLE = 'Member'
187
DEFAULT_EXCEPTION_REPORTER_FILTER = 'horizon.exceptions.HorizonReporterFilter'
189
POLICY_FILES_PATH = os.path.join(ROOT_PATH, "conf")
190
# Map of local copy of service policy files
192
'identity': 'keystone_policy.json',
193
'compute': 'nova_policy.json'
197
from local.local_settings import * # noqa
199
logging.warning("No local_settings file found.")
201
from openstack_dashboard import policy
202
POLICY_CHECK_FUNCTION = policy.check
204
# Add HORIZON_CONFIG to the context information for offline compression
205
COMPRESS_OFFLINE_CONTEXT = {
206
'STATIC_URL': STATIC_URL,
207
'HORIZON_CONFIG': HORIZON_CONFIG
211
logging.basicConfig(level=logging.DEBUG)