disable cassandra from UI
[plstackapi.git] / planetstack / planetstack / settings.py
1 from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS as TCP
2 from django import VERSION as DJANGO_VERSION
3
4 # Django settings for planetstack project.
5 from config import Config
6 config = Config()
7
8 GEOIP_PATH = "/usr/share/GeoIP"
9  
10 DEBUG = True
11 TEMPLATE_DEBUG = DEBUG
12
13 ADMINS = (
14     # ('Your Name', 'your_email@example.com'),
15 )
16
17 LOGIN_REDIRECT_URL = '/admin/core/user'
18
19 MANAGERS = ADMINS
20
21 DATABASES = {
22     'default': {
23         'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
24         'NAME': config.db_name,                      # Or path to database file if using sqlite3.
25         # The following settings are not used with sqlite3:
26         '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.
29         'PORT': '',                      # Set to empty string for default.
30     }
31 }
32
33 AUTH_USER_MODEL = 'core.User'
34
35
36 # 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
38 ALLOWED_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.
44 TIME_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
48 LANGUAGE_CODE = 'en-us'
49
50 SITE_ID = 1
51
52 # If you set this to False, Django will make some optimizations so as not
53 # to load the internationalization machinery.
54 USE_I18N = True
55
56 # If you set this to False, Django will not format dates, numbers and
57 # calendars according to the current locale.
58 USE_L10N = True
59
60 # If you set this to False, Django will not use timezone-aware datetimes.
61 USE_TZ = True
62
63 # Absolute filesystem path to the directory that will hold user-uploaded files.
64 # Example: "/var/www/example.com/media/"
65 MEDIA_ROOT = '/var/www/html/files/'
66
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/"
70 MEDIA_URL = '/files/'
71
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/"
76 STATIC_ROOT = ''
77
78 # URL prefix for static files.
79 # Example: "http://example.com/static/", "http://static.example.com/"
80 STATIC_URL = '/static/'
81
82 # Additional locations of static files
83 STATICFILES_DIRS = ( "/opt/planetstack/core/static/",
84                      "/opt/planetstack/core/xoslib/static/",
85     # 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.
92 STATICFILES_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.
99 SECRET_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.
102 TEMPLATE_LOADERS = (
103     'django.template.loaders.filesystem.Loader',
104     'django.template.loaders.app_directories.Loader',
105 #     'django.template.loaders.eggs.Loader',
106 )
107
108 MIDDLEWARE_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',
114     'core.middleware.GlobalRequestMiddleware',
115     # Uncomment the next line for simple clickjacking protection:
116     # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
117 )
118
119 ROOT_URLCONF = 'planetstack.urls'
120
121 # Python dotted path to the WSGI application used by Django's runserver.
122 WSGI_APPLICATION = 'planetstack.wsgi.application'
123
124 TEMPLATE_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.
128     "/opt/planetstack/templates",
129     "/opt/planetstack/core/xoslib/templates",    
130 )
131
132 INSTALLED_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:
140     'suit',
141     'django.contrib.admin',
142     # Uncomment the next line to enable admin documentation:
143     'django.contrib.admindocs',
144     'rest_framework',
145     'django_extensions',
146     'django_evolution',
147     'core',
148     'hpc',
149     'requestrouter',
150     'cassandra',
151     'kairos',
152     'nagios',
153     'syndicate_storage',
154     'geoposition',
155 )
156
157 if DJANGO_VERSION[1]>=7:
158     # if django >= 1.7, then remove evolution and change the admin module
159     INSTALLED_APPS = list(INSTALLED_APPS)
160     INSTALLED_APPS[INSTALLED_APPS.index('django.contrib.admin')] = 'django.contrib.admin.apps.SimpleAdminConfig'
161     INSTALLED_APPS.remove('django_evolution')
162     INSTALLED_APPS = tuple(INSTALLED_APPS)
163
164 # Added for django-suit form 
165 TEMPLATE_CONTEXT_PROCESSORS = TCP + (
166     'django.core.context_processors.request',
167     'core.context_processors.planetstack',
168 )
169
170 # Django Suit configuration example
171 SUIT_CONFIG = {
172     # header
173     'ADMIN_NAME': 'OpenCloud',
174     # 'HEADER_DATE_FORMAT': 'l, j. F Y',
175     # 'HEADER_TIME_FORMAT': 'H:i',
176
177     # forms
178     #'SHOW_REQUIRED_ASTERISK': True,  # Default True
179     'CONFIRM_UNSAVED_CHANGES': True, # Default True
180
181     # menu
182     # 'SEARCH_URL': '/admin/auth/user/',
183     # 'MENU_ICONS': {
184     #    'sites': 'icon-leaf',
185     #    'auth': 'icon-lock',
186     # },
187     # 'MENU_OPEN_FIRST_CHILD': True, # Default True
188     'MENU_EXCLUDE': (
189          'auth.group',
190          'auth', 
191          'core.network',
192          'core.sliver',
193          'core.node',
194          'core.image',
195          'core.deploymentrole',
196          'core.siterole',
197          'core.slicerole',
198          'core.planetstackrole',
199          'core.networktemplate',
200          'core.networkparametertype',
201          'core.router',
202          'core.tag',
203          'core.account',
204          'core.invoice',
205          'core.serviceclass',
206     ),
207     'MENU': (
208         #{'app': 'core', 'icon':'icon-lock'},
209         #{'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')},
210         {'label': 'Deployments', 'icon':'icon-deployment', 'url': '/admin/core/deployment/'},
211         {'label': 'Sites', 'icon':'icon-site', 'url': '/admin/core/site/'},
212         {'label': 'Slices', 'icon':'icon-slice', 'url': '/admin/core/slice/'},
213         {'label': 'Users', 'icon':'icon-user', 'url': '/admin/core/user/'},
214         {'label': 'RequestRouter', 'icon':'icon-cog', 'app': 'requestrouter'},
215         {'label': 'HyperCache', 'icon':'icon-cog', 'app': 'hpc'},
216         {'label': 'Syndicate', 'icon':'icon-cog', 'app': 'syndicate_storage'},
217 #        {'label': 'Cassandra', 'icon':'icon-cog', 'app': 'cassandra'},
218 #        {'label': 'KairosDB', 'icon':'icon-cog', 'app': 'kairos'},
219 #        {'label': 'Nagios', 'icon':'icon-cog', 'app': 'nagios'},
220
221         #{'label': 'Configured Services', 'icon':'icon-cog', 'models': [{'label': 'Content Delivery Network', 'app':'hpc'}]},
222     #     'sites',
223     #     {'app': 'auth', 'icon':'icon-lock', 'models': ('user', 'group')},
224     #     {'label': 'Support', 'icon':'icon-question-sign', 'url': '/support/'},
225     #   {'label': 'Settings', 'icon':'icon-cog', 'models': ('core.user', 'core.site')},
226     # ),
227     ),
228
229     # misc
230     # 'LIST_PER_PAGE': 15
231 }
232
233 # A sample logging configuration. The only tangible logging
234 # performed by this configuration is to send an email to
235 # the site admins on every HTTP 500 error when DEBUG=False.
236 # See http://docs.djangoproject.com/en/dev/topics/logging for
237 # more details on how to customize your logging configuration.
238 LOGGING = {
239     'version': 1,
240     'disable_existing_loggers': False,
241     'filters': {
242         'require_debug_false': {
243             '()': 'django.utils.log.RequireDebugFalse'
244         }
245     },
246     'handlers': {
247         'mail_admins': {
248             'level': 'ERROR',
249             'filters': ['require_debug_false'],
250             'class': 'django.utils.log.AdminEmailHandler'
251         }
252     },
253     'loggers': {
254         'django.request': {
255             'handlers': ['mail_admins'],
256             'level': 'ERROR',
257             'propagate': True,
258         },
259     }
260 }
261
262 BIGQUERY_TABLE = getattr(config, "bigquery_table", "demoevents")
263
264 DISABLE_MINIDASHBOARD = getattr(config, "gui_disable_minidashboard", False)
265 ENCRYPTED_FIELDS_KEYDIR = '/opt/planetstack/private_keys'
266 ENCRYPTED_FIELD_MODE = 'ENCRYPT'
267
268 # prevents warnings on django 1.7                                                                                                 
269 TEST_RUNNER = 'django.test.runner.DiscoverRunner'