Merge branch 'apigen'
[plstackapi.git] / planetstack / planetstack / settings.py
1 from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS as TCP
2
3 # Django settings for planetstack project.
4 from config import Config
5 config = Config()
6
7 GEOIP_PATH = "/usr/share/GeoIP"
8  
9 DEBUG = True
10 TEMPLATE_DEBUG = DEBUG
11
12 ADMINS = (
13     # ('Your Name', 'your_email@example.com'),
14 )
15
16 LOGIN_REDIRECT_URL = '/admin/core/user'
17
18 MANAGERS = ADMINS
19
20 DATABASES = {
21     'default': {
22         'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
23         'NAME': config.db_name,                      # Or path to database file if using sqlite3.
24         # The following settings are not used with sqlite3:
25         'USER': config.db_user,
26         'PASSWORD': config.db_password,
27         'HOST': config.db_host,                      # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP.
28         'PORT': '',                      # Set to empty string for default.
29     }
30 }
31
32 AUTH_USER_MODEL = 'core.User'
33
34
35 # Hosts/domain names that are valid for this site; required if DEBUG is False
36 # See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
37 ALLOWED_HOSTS = []
38
39 # Local time zone for this installation. Choices can be found here:
40 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
41 # although not all choices may be available on all operating systems.
42 # In a Windows environment this must be set to your system time zone.
43 TIME_ZONE = 'America/New_York'
44
45 # Language code for this installation. All choices can be found here:
46 # http://www.i18nguy.com/unicode/language-identifiers.html
47 LANGUAGE_CODE = 'en-us'
48
49 SITE_ID = 1
50
51 # If you set this to False, Django will make some optimizations so as not
52 # to load the internationalization machinery.
53 USE_I18N = True
54
55 # If you set this to False, Django will not format dates, numbers and
56 # calendars according to the current locale.
57 USE_L10N = True
58
59 # If you set this to False, Django will not use timezone-aware datetimes.
60 USE_TZ = True
61
62 # Absolute filesystem path to the directory that will hold user-uploaded files.
63 # Example: "/var/www/example.com/media/"
64 MEDIA_ROOT = '/var/www/html/files/'
65
66 # URL that handles the media served from MEDIA_ROOT. Make sure to use a
67 # trailing slash.
68 # Examples: "http://example.com/media/", "http://media.example.com/"
69 MEDIA_URL = '/files/'
70
71 # Absolute path to the directory static files should be collected to.
72 # Don't put anything in this directory yourself; store your static files
73 # in apps' "static/" subdirectories and in STATICFILES_DIRS.
74 # Example: "/var/www/example.com/static/"
75 STATIC_ROOT = ''
76
77 # URL prefix for static files.
78 # Example: "http://example.com/static/", "http://static.example.com/"
79 STATIC_URL = '/static/'
80
81 # Additional locations of static files
82 STATICFILES_DIRS = ( "/opt/planetstack/core/static/",
83     # Put strings here, like "/home/html/static" or "C:/www/django/static".
84     # Always use forward slashes, even on Windows.
85     # Don't forget to use absolute paths, not relative paths.
86 )
87
88 # List of finder classes that know how to find static files in
89 # various locations.
90 STATICFILES_FINDERS = (
91     'django.contrib.staticfiles.finders.FileSystemFinder',
92     'django.contrib.staticfiles.finders.AppDirectoriesFinder',
93 #    'django.contrib.staticfiles.finders.DefaultStorageFinder',
94 )
95
96 # Make this unique, and don't share it with anybody.
97 SECRET_KEY = 'i0=a)c7_#2)5m%k_fu#%53xap$tlqc+#&z5as+bl7&)(@be_f9'
98
99 # List of callables that know how to import templates from various sources.
100 TEMPLATE_LOADERS = (
101     'django.template.loaders.filesystem.Loader',
102     'django.template.loaders.app_directories.Loader',
103 #     'django.template.loaders.eggs.Loader',
104 )
105
106 MIDDLEWARE_CLASSES = (
107     'django.middleware.common.CommonMiddleware',
108     'django.contrib.sessions.middleware.SessionMiddleware',
109     'django.middleware.csrf.CsrfViewMiddleware',
110     'django.contrib.auth.middleware.AuthenticationMiddleware',
111     'django.contrib.messages.middleware.MessageMiddleware',
112     # Uncomment the next line for simple clickjacking protection:
113     # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
114 )
115
116 ROOT_URLCONF = 'planetstack.urls'
117
118 # Python dotted path to the WSGI application used by Django's runserver.
119 WSGI_APPLICATION = 'planetstack.wsgi.application'
120
121 TEMPLATE_DIRS = (
122     # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
123     # Always use forward slashes, even on Windows.
124     # Don't forget to use absolute paths, not relative paths.
125     "/opt/planetstack/templates"
126 )
127
128 INSTALLED_APPS = (
129     'django.contrib.auth',
130     'django.contrib.contenttypes',
131     'django.contrib.sessions',
132 #    'django.contrib.sites',
133     'django.contrib.messages',
134     'django.contrib.staticfiles',
135     # Uncomment the next line to enable the admin:
136     'suit',
137     'django.contrib.admin',
138     # Uncomment the next line to enable admin documentation:
139     'django.contrib.admindocs',
140     'rest_framework',
141     'django_extensions',
142     'django_evolution',
143     'core',
144     'hpc',
145     'requestrouter',
146     'cassandra',
147     'kairos',
148     'nagios',
149     'syndicate',
150     'geoposition',
151 )
152
153
154 # Added for django-suit form 
155 TEMPLATE_CONTEXT_PROCESSORS = TCP + (
156     'django.core.context_processors.request',
157     'core.context_processors.planetstack',
158 )
159
160 # Django Suit configuration example
161 SUIT_CONFIG = {
162     # header
163     'ADMIN_NAME': 'OpenCloud',
164     # 'HEADER_DATE_FORMAT': 'l, j. F Y',
165     # 'HEADER_TIME_FORMAT': 'H:i',
166
167     # forms
168     #'SHOW_REQUIRED_ASTERISK': True,  # Default True
169     'CONFIRM_UNSAVED_CHANGES': True, # Default True
170
171     # menu
172     # 'SEARCH_URL': '/admin/auth/user/',
173     # 'MENU_ICONS': {
174     #    'sites': 'icon-leaf',
175     #    'auth': 'icon-lock',
176     # },
177     # 'MENU_OPEN_FIRST_CHILD': True, # Default True
178     'MENU_EXCLUDE': (
179          'auth.group',
180          'auth', 
181          'core.network',
182          'core.sliver',
183          'core.node',
184          'core.image',
185          'core.deploymentrole',
186          'core.siterole',
187          'core.slicerole',
188          'core.planetstackrole',
189          'core.networktemplate',
190          'core.networkparametertype',
191          'core.router',
192          'core.tag',
193          'core.account',
194          'core.invoice',
195          'core.serviceclass',
196     ),
197     'MENU': (
198         #{'app': 'core', 'icon':'icon-lock'},
199         #{'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')},
200         {'label': 'Deployments', 'icon':'icon-deployment', 'url': '/admin/core/deployment/'},
201         {'label': 'Sites', 'icon':'icon-site', 'url': '/admin/core/site/'},
202         {'label': 'Slices', 'icon':'icon-slice', 'url': '/admin/core/slice/'},
203         {'label': 'Users', 'icon':'icon-user', 'url': '/admin/core/user/'},
204         {'label': 'RequestRouter', 'icon':'icon-cog', 'app': 'requestrouter'},
205         {'label': 'HyperCache', 'icon':'icon-cog', 'app': 'hpc'},
206         {'label': 'Syndicate', 'icon':'icon-cog', 'app': 'syndicate'},
207         {'label': 'Cassandra', 'icon':'icon-cog', 'app': 'cassandra'},
208 #        {'label': 'KairosDB', 'icon':'icon-cog', 'app': 'kairos'},
209 #        {'label': 'Nagios', 'icon':'icon-cog', 'app': 'nagios'},
210
211         #{'label': 'Configured Services', 'icon':'icon-cog', 'models': [{'label': 'Content Delivery Network', 'app':'hpc'}]},
212     #     'sites',
213     #     {'app': 'auth', 'icon':'icon-lock', 'models': ('user', 'group')},
214     #     {'label': 'Support', 'icon':'icon-question-sign', 'url': '/support/'},
215     #   {'label': 'Settings', 'icon':'icon-cog', 'models': ('core.user', 'core.site')},
216     # ),
217     ),
218
219     # misc
220     # 'LIST_PER_PAGE': 15
221 }
222
223 # A sample logging configuration. The only tangible logging
224 # performed by this configuration is to send an email to
225 # the site admins on every HTTP 500 error when DEBUG=False.
226 # See http://docs.djangoproject.com/en/dev/topics/logging for
227 # more details on how to customize your logging configuration.
228 LOGGING = {
229     'version': 1,
230     'disable_existing_loggers': False,
231     'filters': {
232         'require_debug_false': {
233             '()': 'django.utils.log.RequireDebugFalse'
234         }
235     },
236     'handlers': {
237         'mail_admins': {
238             'level': 'ERROR',
239             'filters': ['require_debug_false'],
240             'class': 'django.utils.log.AdminEmailHandler'
241         }
242     },
243     'loggers': {
244         'django.request': {
245             'handlers': ['mail_admins'],
246             'level': 'ERROR',
247             'propagate': True,
248         },
249     }
250 }
251
252 BIGQUERY_TABLE = getattr(config, "bigquery_table", "demoevents")
253
254 DISABLE_MINIDASHBOARD = getattr(config, "gui_disable_minidashboard", False)