~ubuntu-branches/ubuntu/trusty/horizon/trusty-updates

« back to all changes in this revision

Viewing changes to .pc/ubuntu_settings.patch/openstack_dashboard/settings.py

  • Committer: Package Import Robot
  • Author(s): Adam Gandelman
  • Date: 2013-09-06 11:59:43 UTC
  • mfrom: (1.1.30)
  • Revision ID: package-import@ubuntu.com-20130906115943-h3td0l7tp16mb9oc
Tags: 1:2013.2~b3-0ubuntu1
* New upstream release.
* debian/control: Minimum python-openstack-auth version >= 1.1.1.
* debian/control: Add python-troveclient.
* debian/static: Refresh static assets for 2013.2~b3.
* debian/patches: ubuntu_local_settings.patch -> ubuntu_settings.patch, also
  patch location of secret key in openstack_dashboard/settings.py

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# vim: tabstop=4 shiftwidth=4 softtabstop=4
 
2
 
 
3
# Copyright 2012 United States Government as represented by the
 
4
# Administrator of the National Aeronautics and Space Administration.
 
5
# All Rights Reserved.
 
6
#
 
7
# Copyright 2012 Nebula, Inc.
 
8
#
 
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
 
12
#
 
13
#         http://www.apache.org/licenses/LICENSE-2.0
 
14
#
 
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
 
19
#    under the License.
 
20
 
 
21
import logging
 
22
import os
 
23
import sys
 
24
import warnings
 
25
 
 
26
from openstack_dashboard import exceptions
 
27
 
 
28
warnings.formatwarning = lambda message, category, *args, **kwargs: \
 
29
                                '%s: %s' % (category.__name__, message)
 
30
 
 
31
ROOT_PATH = os.path.dirname(os.path.abspath(__file__))
 
32
BIN_DIR = os.path.abspath(os.path.join(ROOT_PATH, '..', 'bin'))
 
33
 
 
34
if ROOT_PATH not in sys.path:
 
35
    sys.path.append(ROOT_PATH)
 
36
 
 
37
DEBUG = False
 
38
TEMPLATE_DEBUG = DEBUG
 
39
 
 
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,
 
46
                                                   '.secret_key_store'))
 
47
 
 
48
SITE_BRANDING = 'OpenStack Dashboard'
 
49
 
 
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 = '/'
 
56
 
 
57
MEDIA_ROOT = os.path.abspath(os.path.join(ROOT_PATH, '..', 'media'))
 
58
MEDIA_URL = '/media/'
 
59
STATIC_ROOT = os.path.abspath(os.path.join(ROOT_PATH, '..', 'static'))
 
60
STATIC_URL = '/static/'
 
61
 
 
62
ROOT_URLCONF = 'openstack_dashboard.urls'
 
63
 
 
64
HORIZON_CONFIG = {
 
65
    'dashboards': ('project', 'admin', 'settings', 'router',),
 
66
    'default_dashboard': 'project',
 
67
    'user_home': 'openstack_dashboard.views.get_user_home',
 
68
    'ajax_queue_limit': 10,
 
69
    'auto_fade_alerts': {
 
70
        'delay': 3000,
 
71
        'fade_duration': 1500,
 
72
        'types': ['alert-success', 'alert-info']
 
73
    },
 
74
    'help_url': "http://docs.openstack.org",
 
75
    'exceptions': {'recoverable': exceptions.RECOVERABLE,
 
76
                   'not_found': exceptions.NOT_FOUND,
 
77
                   'unauthorized': exceptions.UNAUTHORIZED},
 
78
}
 
79
 
 
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
 
84
 
 
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',
 
95
)
 
96
 
 
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',
 
106
)
 
107
 
 
108
TEMPLATE_LOADERS = (
 
109
    'django.template.loaders.filesystem.Loader',
 
110
    'django.template.loaders.app_directories.Loader',
 
111
    'horizon.loaders.TemplateLoader'
 
112
)
 
113
 
 
114
TEMPLATE_DIRS = (
 
115
    os.path.join(ROOT_PATH, 'templates'),
 
116
)
 
117
 
 
118
STATICFILES_FINDERS = (
 
119
    'compressor.finders.CompressorFinder',
 
120
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
 
121
)
 
122
 
 
123
COMPRESS_PRECOMPILERS = (
 
124
    ('text/less', ('lesscpy {infile}')),
 
125
)
 
126
 
 
127
COMPRESS_CSS_FILTERS = (
 
128
    'compressor.filters.css_default.CssAbsoluteFilter',
 
129
)
 
130
 
 
131
COMPRESS_ENABLED = True
 
132
COMPRESS_OUTPUT_DIR = 'dashboard'
 
133
COMPRESS_CSS_HASHING_METHOD = 'hash'
 
134
COMPRESS_PARSER = 'compressor.parser.HtmlParser'
 
135
 
 
136
INSTALLED_APPS = (
 
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',
 
144
    'compressor',
 
145
    'horizon',
 
146
    'openstack_dashboard.dashboards.project',
 
147
    'openstack_dashboard.dashboards.admin',
 
148
    'openstack_dashboard.dashboards.settings',
 
149
    'openstack_auth',
 
150
    'openstack_dashboard.dashboards.router',
 
151
)
 
152
 
 
153
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
 
154
AUTHENTICATION_BACKENDS = ('openstack_auth.backend.KeystoneBackend',)
 
155
MESSAGE_STORAGE = 'django.contrib.messages.storage.cookie.CookieStorage'
 
156
 
 
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
 
162
 
 
163
gettext_noop = lambda s: s
 
164
LANGUAGES = (
 
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')),
 
179
)
 
180
LANGUAGE_CODE = 'en'
 
181
USE_I18N = True
 
182
USE_L10N = True
 
183
USE_TZ = True
 
184
 
 
185
OPENSTACK_KEYSTONE_DEFAULT_ROLE = 'Member'
 
186
 
 
187
DEFAULT_EXCEPTION_REPORTER_FILTER = 'horizon.exceptions.HorizonReporterFilter'
 
188
 
 
189
POLICY_FILES_PATH = os.path.join(ROOT_PATH, "conf")
 
190
# Map of local copy of service policy files
 
191
POLICY_FILES = {
 
192
    'identity': 'keystone_policy.json',
 
193
    'compute': 'nova_policy.json'
 
194
}
 
195
 
 
196
try:
 
197
    from local.local_settings import *  # noqa
 
198
except ImportError:
 
199
    logging.warning("No local_settings file found.")
 
200
 
 
201
from openstack_dashboard import policy
 
202
POLICY_CHECK_FUNCTION = policy.check
 
203
 
 
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
 
208
}
 
209
 
 
210
if DEBUG:
 
211
    logging.basicConfig(level=logging.DEBUG)