blob: f7f151ba89dc09834850559a0a072a765dc61e3e [file] [log] [blame]
Siobhan Tullybfd11dc2013-09-03 12:59:24 -04001from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS as TCP
Scott Bakerb9396c22014-06-16 13:58:21 -07002from django import VERSION as DJANGO_VERSION
Siobhan Tullybfd11dc2013-09-03 12:59:24 -04003
Tony Mack7130ac32013-03-22 21:58:00 -04004# Django settings for planetstack project.
Tony Macke485af32013-05-10 17:15:32 -04005from config import Config
6config = Config()
Scott Baker8a867eb2014-04-22 13:50:26 -07007
8GEOIP_PATH = "/usr/share/GeoIP"
Scott Baker40695e12014-03-13 22:50:45 -07009
Tony Mack7130ac32013-03-22 21:58:00 -040010DEBUG = True
11TEMPLATE_DEBUG = DEBUG
12
13ADMINS = (
14 # ('Your Name', 'your_email@example.com'),
15)
16
Siobhan Tullycf04fb62014-01-11 11:25:57 -050017LOGIN_REDIRECT_URL = '/admin/core/user'
18
Tony Mack7130ac32013-03-22 21:58:00 -040019MANAGERS = ADMINS
20
21DATABASES = {
22 'default': {
23 'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
Tony Macke485af32013-05-10 17:15:32 -040024 'NAME': config.db_name, # Or path to database file if using sqlite3.
Tony Mack7130ac32013-03-22 21:58:00 -040025 # The following settings are not used with sqlite3:
Tony Macke485af32013-05-10 17:15:32 -040026 'USER': config.db_user,
27 'PASSWORD': config.db_password,
28 'HOST': config.db_host, # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP.
Tony Mack7130ac32013-03-22 21:58:00 -040029 'PORT': '', # Set to empty string for default.
30 }
31}
32
Siobhan Tully30fd4292013-05-10 08:59:56 -040033AUTH_USER_MODEL = 'core.User'
34
Siobhan Tullybfd11dc2013-09-03 12:59:24 -040035
Tony Mack7130ac32013-03-22 21:58:00 -040036# Hosts/domain names that are valid for this site; required if DEBUG is False
37# See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
38ALLOWED_HOSTS = []
39
40# Local time zone for this installation. Choices can be found here:
41# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
42# although not all choices may be available on all operating systems.
43# In a Windows environment this must be set to your system time zone.
44TIME_ZONE = 'America/New_York'
45
46# Language code for this installation. All choices can be found here:
47# http://www.i18nguy.com/unicode/language-identifiers.html
48LANGUAGE_CODE = 'en-us'
49
50SITE_ID = 1
51
52# If you set this to False, Django will make some optimizations so as not
53# to load the internationalization machinery.
54USE_I18N = True
55
56# If you set this to False, Django will not format dates, numbers and
57# calendars according to the current locale.
58USE_L10N = True
59
60# If you set this to False, Django will not use timezone-aware datetimes.
61USE_TZ = True
62
63# Absolute filesystem path to the directory that will hold user-uploaded files.
64# Example: "/var/www/example.com/media/"
Scott Baker40695e12014-03-13 22:50:45 -070065MEDIA_ROOT = '/var/www/html/files/'
Tony Mack7130ac32013-03-22 21:58:00 -040066
67# URL that handles the media served from MEDIA_ROOT. Make sure to use a
68# trailing slash.
69# Examples: "http://example.com/media/", "http://media.example.com/"
Scott Baker40695e12014-03-13 22:50:45 -070070MEDIA_URL = '/files/'
Tony Mack7130ac32013-03-22 21:58:00 -040071
72# Absolute path to the directory static files should be collected to.
73# Don't put anything in this directory yourself; store your static files
74# in apps' "static/" subdirectories and in STATICFILES_DIRS.
75# Example: "/var/www/example.com/static/"
76STATIC_ROOT = ''
77
78# URL prefix for static files.
79# Example: "http://example.com/static/", "http://static.example.com/"
80STATIC_URL = '/static/'
81
82# Additional locations of static files
Siobhan Tullybfd11dc2013-09-03 12:59:24 -040083STATICFILES_DIRS = ( "/opt/planetstack/core/static/",
Scott Baker75f4be22014-07-13 16:23:32 -070084 "/opt/planetstack/core/xoslib/static/",
Tony Mack7130ac32013-03-22 21:58:00 -040085 # Put strings here, like "/home/html/static" or "C:/www/django/static".
86 # Always use forward slashes, even on Windows.
87 # Don't forget to use absolute paths, not relative paths.
88)
89
90# List of finder classes that know how to find static files in
91# various locations.
92STATICFILES_FINDERS = (
93 'django.contrib.staticfiles.finders.FileSystemFinder',
94 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
95# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
96)
97
98# Make this unique, and don't share it with anybody.
99SECRET_KEY = 'i0=a)c7_#2)5m%k_fu#%53xap$tlqc+#&z5as+bl7&)(@be_f9'
100
101# List of callables that know how to import templates from various sources.
102TEMPLATE_LOADERS = (
103 'django.template.loaders.filesystem.Loader',
104 'django.template.loaders.app_directories.Loader',
105# 'django.template.loaders.eggs.Loader',
106)
107
108MIDDLEWARE_CLASSES = (
109 'django.middleware.common.CommonMiddleware',
110 'django.contrib.sessions.middleware.SessionMiddleware',
111 'django.middleware.csrf.CsrfViewMiddleware',
112 'django.contrib.auth.middleware.AuthenticationMiddleware',
113 'django.contrib.messages.middleware.MessageMiddleware',
Scott Baker6810db22014-08-26 17:40:36 -0700114 'core.middleware.GlobalRequestMiddleware',
Tony Mack7130ac32013-03-22 21:58:00 -0400115 # Uncomment the next line for simple clickjacking protection:
116 # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
117)
118
Siobhan Tully30fd4292013-05-10 08:59:56 -0400119ROOT_URLCONF = 'planetstack.urls'
Tony Mack7130ac32013-03-22 21:58:00 -0400120
121# Python dotted path to the WSGI application used by Django's runserver.
Siobhan Tully30fd4292013-05-10 08:59:56 -0400122WSGI_APPLICATION = 'planetstack.wsgi.application'
Tony Mack7130ac32013-03-22 21:58:00 -0400123
124TEMPLATE_DIRS = (
125 # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
126 # Always use forward slashes, even on Windows.
127 # Don't forget to use absolute paths, not relative paths.
Scott Bakerb9396c22014-06-16 13:58:21 -0700128 "/opt/planetstack/templates",
Scott Baker75f4be22014-07-13 16:23:32 -0700129 "/opt/planetstack/core/xoslib/templates",
Tony Mack7130ac32013-03-22 21:58:00 -0400130)
131
132INSTALLED_APPS = (
133 'django.contrib.auth',
134 'django.contrib.contenttypes',
135 'django.contrib.sessions',
136# 'django.contrib.sites',
137 'django.contrib.messages',
138 'django.contrib.staticfiles',
139 # Uncomment the next line to enable the admin:
Siobhan Tullybfd11dc2013-09-03 12:59:24 -0400140 'suit',
Tony Mack7130ac32013-03-22 21:58:00 -0400141 'django.contrib.admin',
142 # Uncomment the next line to enable admin documentation:
143 'django.contrib.admindocs',
144 'rest_framework',
145 'django_extensions',
Tony Mack7130ac32013-03-22 21:58:00 -0400146 'django_evolution',
Siobhan Tullybf1153a2013-05-27 20:53:48 -0400147 'core',
Siobhan Tullybfd11dc2013-09-03 12:59:24 -0400148 'hpc',
Siobhan Tullyce652d02013-10-08 21:52:35 -0400149 'requestrouter',
Scott Bakerd219e1e2014-05-20 12:04:25 -0700150 'cassandra',
Scott Baker3bcf71e2014-06-03 16:29:23 -0700151 'kairos',
152 'nagios',
Scott Baker169c7232015-01-03 16:51:01 -0800153# 'urlfilter',
154 'servcomp',
jcnelson160012b2014-07-10 19:32:58 -0400155 'syndicate_storage',
Siobhan Tullybfd11dc2013-09-03 12:59:24 -0400156 'geoposition',
Tony Mack7130ac32013-03-22 21:58:00 -0400157)
158
Scott Bakerb9396c22014-06-16 13:58:21 -0700159if DJANGO_VERSION[1]>=7:
160 # if django >= 1.7, then remove evolution and change the admin module
161 INSTALLED_APPS = list(INSTALLED_APPS)
162 INSTALLED_APPS[INSTALLED_APPS.index('django.contrib.admin')] = 'django.contrib.admin.apps.SimpleAdminConfig'
163 INSTALLED_APPS.remove('django_evolution')
164 INSTALLED_APPS = tuple(INSTALLED_APPS)
Siobhan Tullybfd11dc2013-09-03 12:59:24 -0400165
166# Added for django-suit form
167TEMPLATE_CONTEXT_PROCESSORS = TCP + (
168 'django.core.context_processors.request',
Scott Bakera226eb42014-06-09 11:55:26 -0700169 'core.context_processors.planetstack',
Siobhan Tullybfd11dc2013-09-03 12:59:24 -0400170)
171
172# Django Suit configuration example
173SUIT_CONFIG = {
174 # header
Siobhan Tullycf04fb62014-01-11 11:25:57 -0500175 'ADMIN_NAME': 'OpenCloud',
Siobhan Tullybfd11dc2013-09-03 12:59:24 -0400176 # 'HEADER_DATE_FORMAT': 'l, j. F Y',
177 # 'HEADER_TIME_FORMAT': 'H:i',
178
179 # forms
180 #'SHOW_REQUIRED_ASTERISK': True, # Default True
181 'CONFIRM_UNSAVED_CHANGES': True, # Default True
182
183 # menu
184 # 'SEARCH_URL': '/admin/auth/user/',
185 # 'MENU_ICONS': {
186 # 'sites': 'icon-leaf',
187 # 'auth': 'icon-lock',
188 # },
189 # 'MENU_OPEN_FIRST_CHILD': True, # Default True
Siobhan Tullycf04fb62014-01-11 11:25:57 -0500190 'MENU_EXCLUDE': (
191 'auth.group',
192 'auth',
193 'core.network',
194 'core.sliver',
195 'core.node',
196 'core.image',
197 'core.deploymentrole',
198 'core.siterole',
199 'core.slicerole',
200 'core.planetstackrole',
201 'core.networktemplate',
202 'core.networkparametertype',
203 'core.router',
204 'core.tag',
205 'core.account',
206 'core.invoice',
207 'core.serviceclass',
Siobhan Tullybfd11dc2013-09-03 12:59:24 -0400208 ),
Siobhan Tullycf04fb62014-01-11 11:25:57 -0500209 'MENU': (
210 #{'app': 'core', 'icon':'icon-lock'},
211 #{'app': 'core', 'icon': 'icon-lock', 'models': ('core.site', 'core.deployment', 'core.service', 'core.slice', 'core.user', 'core.reservation', 'core.account', 'core.invoice', 'core.payment', 'core.usableobject')},
212 {'label': 'Deployments', 'icon':'icon-deployment', 'url': '/admin/core/deployment/'},
213 {'label': 'Sites', 'icon':'icon-site', 'url': '/admin/core/site/'},
214 {'label': 'Slices', 'icon':'icon-slice', 'url': '/admin/core/slice/'},
215 {'label': 'Users', 'icon':'icon-user', 'url': '/admin/core/user/'},
Scott Bakerd219e1e2014-05-20 12:04:25 -0700216 {'label': 'RequestRouter', 'icon':'icon-cog', 'app': 'requestrouter'},
Siobhan Tullycf04fb62014-01-11 11:25:57 -0500217 {'label': 'HyperCache', 'icon':'icon-cog', 'app': 'hpc'},
jcnelson160012b2014-07-10 19:32:58 -0400218 {'label': 'Syndicate', 'icon':'icon-cog', 'app': 'syndicate_storage'},
Scott Baker9cc8bce2014-10-12 10:47:40 -0700219# {'label': 'Cassandra', 'icon':'icon-cog', 'app': 'cassandra'},
Scott Baker6ced3a72014-05-23 14:41:14 -0700220# {'label': 'KairosDB', 'icon':'icon-cog', 'app': 'kairos'},
221# {'label': 'Nagios', 'icon':'icon-cog', 'app': 'nagios'},
Scott Baker169c7232015-01-03 16:51:01 -0800222# {'label': 'URL Filter', 'icon': 'icon-cog', 'app': 'urlfilter'},
223 {'label': 'Service Comp', 'icon': 'icon-cog', 'app': 'servcomp'},
Scott Bakerd219e1e2014-05-20 12:04:25 -0700224
Siobhan Tullycf04fb62014-01-11 11:25:57 -0500225 #{'label': 'Configured Services', 'icon':'icon-cog', 'models': [{'label': 'Content Delivery Network', 'app':'hpc'}]},
Siobhan Tullybfd11dc2013-09-03 12:59:24 -0400226 # 'sites',
227 # {'app': 'auth', 'icon':'icon-lock', 'models': ('user', 'group')},
Siobhan Tullybfd11dc2013-09-03 12:59:24 -0400228 # {'label': 'Support', 'icon':'icon-question-sign', 'url': '/support/'},
Siobhan Tullycf04fb62014-01-11 11:25:57 -0500229 # {'label': 'Settings', 'icon':'icon-cog', 'models': ('core.user', 'core.site')},
Siobhan Tullybfd11dc2013-09-03 12:59:24 -0400230 # ),
Siobhan Tullycf04fb62014-01-11 11:25:57 -0500231 ),
Siobhan Tullybfd11dc2013-09-03 12:59:24 -0400232
233 # misc
234 # 'LIST_PER_PAGE': 15
235}
236
Tony Mack7130ac32013-03-22 21:58:00 -0400237# A sample logging configuration. The only tangible logging
238# performed by this configuration is to send an email to
239# the site admins on every HTTP 500 error when DEBUG=False.
240# See http://docs.djangoproject.com/en/dev/topics/logging for
241# more details on how to customize your logging configuration.
242LOGGING = {
243 'version': 1,
244 'disable_existing_loggers': False,
245 'filters': {
246 'require_debug_false': {
247 '()': 'django.utils.log.RequireDebugFalse'
248 }
249 },
250 'handlers': {
251 'mail_admins': {
252 'level': 'ERROR',
253 'filters': ['require_debug_false'],
254 'class': 'django.utils.log.AdminEmailHandler'
255 }
256 },
257 'loggers': {
258 'django.request': {
259 'handlers': ['mail_admins'],
260 'level': 'ERROR',
261 'propagate': True,
262 },
263 }
264}
Scott Bakerc40941b2014-04-25 12:20:47 -0700265
266BIGQUERY_TABLE = getattr(config, "bigquery_table", "demoevents")
Scott Bakera226eb42014-06-09 11:55:26 -0700267
268DISABLE_MINIDASHBOARD = getattr(config, "gui_disable_minidashboard", False)
Sapan Bhatia98048082014-09-08 11:08:59 -0400269ENCRYPTED_FIELDS_KEYDIR = '/opt/planetstack/private_keys'
270ENCRYPTED_FIELD_MODE = 'ENCRYPT'
Scott Baker370cdd52014-09-12 12:38:34 -0700271
Scott Baker169c7232015-01-03 16:51:01 -0800272STATISTICS_DRIVER = getattr(config, "statistics_driver", "ceilometer")
273
Scott Baker370cdd52014-09-12 12:38:34 -0700274# prevents warnings on django 1.7
275TEST_RUNNER = 'django.test.runner.DiscoverRunner'