Siobhan Tully | bfd11dc | 2013-09-03 12:59:24 -0400 | [diff] [blame] | 1 | from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS as TCP |
Scott Baker | b9396c2 | 2014-06-16 13:58:21 -0700 | [diff] [blame] | 2 | from django import VERSION as DJANGO_VERSION |
Siobhan Tully | bfd11dc | 2013-09-03 12:59:24 -0400 | [diff] [blame] | 3 | |
Tony Mack | 7130ac3 | 2013-03-22 21:58:00 -0400 | [diff] [blame] | 4 | # Django settings for planetstack project. |
Tony Mack | e485af3 | 2013-05-10 17:15:32 -0400 | [diff] [blame] | 5 | from config import Config |
| 6 | config = Config() |
Scott Baker | 8a867eb | 2014-04-22 13:50:26 -0700 | [diff] [blame] | 7 | |
| 8 | GEOIP_PATH = "/usr/share/GeoIP" |
Scott Baker | 40695e1 | 2014-03-13 22:50:45 -0700 | [diff] [blame] | 9 | |
Tony Mack | 7130ac3 | 2013-03-22 21:58:00 -0400 | [diff] [blame] | 10 | DEBUG = True |
| 11 | TEMPLATE_DEBUG = DEBUG |
| 12 | |
| 13 | ADMINS = ( |
| 14 | # ('Your Name', 'your_email@example.com'), |
| 15 | ) |
| 16 | |
Siobhan Tully | cf04fb6 | 2014-01-11 11:25:57 -0500 | [diff] [blame] | 17 | LOGIN_REDIRECT_URL = '/admin/core/user' |
| 18 | |
Tony Mack | 7130ac3 | 2013-03-22 21:58:00 -0400 | [diff] [blame] | 19 | MANAGERS = ADMINS |
| 20 | |
| 21 | DATABASES = { |
| 22 | 'default': { |
| 23 | 'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. |
Tony Mack | e485af3 | 2013-05-10 17:15:32 -0400 | [diff] [blame] | 24 | 'NAME': config.db_name, # Or path to database file if using sqlite3. |
Tony Mack | 7130ac3 | 2013-03-22 21:58:00 -0400 | [diff] [blame] | 25 | # The following settings are not used with sqlite3: |
Tony Mack | e485af3 | 2013-05-10 17:15:32 -0400 | [diff] [blame] | 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. |
Tony Mack | 7130ac3 | 2013-03-22 21:58:00 -0400 | [diff] [blame] | 29 | 'PORT': '', # Set to empty string for default. |
| 30 | } |
| 31 | } |
| 32 | |
Siobhan Tully | 30fd429 | 2013-05-10 08:59:56 -0400 | [diff] [blame] | 33 | AUTH_USER_MODEL = 'core.User' |
| 34 | |
Siobhan Tully | bfd11dc | 2013-09-03 12:59:24 -0400 | [diff] [blame] | 35 | |
Tony Mack | 7130ac3 | 2013-03-22 21:58:00 -0400 | [diff] [blame] | 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/" |
Scott Baker | 40695e1 | 2014-03-13 22:50:45 -0700 | [diff] [blame] | 65 | MEDIA_ROOT = '/var/www/html/files/' |
Tony Mack | 7130ac3 | 2013-03-22 21:58:00 -0400 | [diff] [blame] | 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/" |
Scott Baker | 40695e1 | 2014-03-13 22:50:45 -0700 | [diff] [blame] | 70 | MEDIA_URL = '/files/' |
Tony Mack | 7130ac3 | 2013-03-22 21:58:00 -0400 | [diff] [blame] | 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 |
Siobhan Tully | bfd11dc | 2013-09-03 12:59:24 -0400 | [diff] [blame] | 83 | STATICFILES_DIRS = ( "/opt/planetstack/core/static/", |
Scott Baker | 75f4be2 | 2014-07-13 16:23:32 -0700 | [diff] [blame^] | 84 | "/opt/planetstack/core/xoslib/static/", |
Tony Mack | 7130ac3 | 2013-03-22 21:58:00 -0400 | [diff] [blame] | 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 | # Uncomment the next line for simple clickjacking protection: |
| 115 | # 'django.middleware.clickjacking.XFrameOptionsMiddleware', |
| 116 | ) |
| 117 | |
Siobhan Tully | 30fd429 | 2013-05-10 08:59:56 -0400 | [diff] [blame] | 118 | ROOT_URLCONF = 'planetstack.urls' |
Tony Mack | 7130ac3 | 2013-03-22 21:58:00 -0400 | [diff] [blame] | 119 | |
| 120 | # Python dotted path to the WSGI application used by Django's runserver. |
Siobhan Tully | 30fd429 | 2013-05-10 08:59:56 -0400 | [diff] [blame] | 121 | WSGI_APPLICATION = 'planetstack.wsgi.application' |
Tony Mack | 7130ac3 | 2013-03-22 21:58:00 -0400 | [diff] [blame] | 122 | |
| 123 | TEMPLATE_DIRS = ( |
| 124 | # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". |
| 125 | # Always use forward slashes, even on Windows. |
| 126 | # Don't forget to use absolute paths, not relative paths. |
Scott Baker | b9396c2 | 2014-06-16 13:58:21 -0700 | [diff] [blame] | 127 | "/opt/planetstack/templates", |
Scott Baker | 75f4be2 | 2014-07-13 16:23:32 -0700 | [diff] [blame^] | 128 | "/opt/planetstack/core/xoslib/templates", |
Tony Mack | 7130ac3 | 2013-03-22 21:58:00 -0400 | [diff] [blame] | 129 | ) |
| 130 | |
| 131 | INSTALLED_APPS = ( |
| 132 | 'django.contrib.auth', |
| 133 | 'django.contrib.contenttypes', |
| 134 | 'django.contrib.sessions', |
| 135 | # 'django.contrib.sites', |
| 136 | 'django.contrib.messages', |
| 137 | 'django.contrib.staticfiles', |
| 138 | # Uncomment the next line to enable the admin: |
Siobhan Tully | bfd11dc | 2013-09-03 12:59:24 -0400 | [diff] [blame] | 139 | 'suit', |
Tony Mack | 7130ac3 | 2013-03-22 21:58:00 -0400 | [diff] [blame] | 140 | 'django.contrib.admin', |
| 141 | # Uncomment the next line to enable admin documentation: |
| 142 | 'django.contrib.admindocs', |
| 143 | 'rest_framework', |
| 144 | 'django_extensions', |
Tony Mack | 7130ac3 | 2013-03-22 21:58:00 -0400 | [diff] [blame] | 145 | 'django_evolution', |
Siobhan Tully | bf1153a | 2013-05-27 20:53:48 -0400 | [diff] [blame] | 146 | 'core', |
Siobhan Tully | bfd11dc | 2013-09-03 12:59:24 -0400 | [diff] [blame] | 147 | 'hpc', |
Siobhan Tully | ce652d0 | 2013-10-08 21:52:35 -0400 | [diff] [blame] | 148 | 'requestrouter', |
Scott Baker | d219e1e | 2014-05-20 12:04:25 -0700 | [diff] [blame] | 149 | 'cassandra', |
Scott Baker | 3bcf71e | 2014-06-03 16:29:23 -0700 | [diff] [blame] | 150 | 'kairos', |
| 151 | 'nagios', |
Siobhan Tully | cf04fb6 | 2014-01-11 11:25:57 -0500 | [diff] [blame] | 152 | 'syndicate', |
Siobhan Tully | bfd11dc | 2013-09-03 12:59:24 -0400 | [diff] [blame] | 153 | 'geoposition', |
Tony Mack | 7130ac3 | 2013-03-22 21:58:00 -0400 | [diff] [blame] | 154 | ) |
| 155 | |
Scott Baker | b9396c2 | 2014-06-16 13:58:21 -0700 | [diff] [blame] | 156 | if DJANGO_VERSION[1]>=7: |
| 157 | # if django >= 1.7, then remove evolution and change the admin module |
| 158 | INSTALLED_APPS = list(INSTALLED_APPS) |
| 159 | INSTALLED_APPS[INSTALLED_APPS.index('django.contrib.admin')] = 'django.contrib.admin.apps.SimpleAdminConfig' |
| 160 | INSTALLED_APPS.remove('django_evolution') |
| 161 | INSTALLED_APPS = tuple(INSTALLED_APPS) |
Siobhan Tully | bfd11dc | 2013-09-03 12:59:24 -0400 | [diff] [blame] | 162 | |
| 163 | # Added for django-suit form |
| 164 | TEMPLATE_CONTEXT_PROCESSORS = TCP + ( |
| 165 | 'django.core.context_processors.request', |
Scott Baker | a226eb4 | 2014-06-09 11:55:26 -0700 | [diff] [blame] | 166 | 'core.context_processors.planetstack', |
Siobhan Tully | bfd11dc | 2013-09-03 12:59:24 -0400 | [diff] [blame] | 167 | ) |
| 168 | |
| 169 | # Django Suit configuration example |
| 170 | SUIT_CONFIG = { |
| 171 | # header |
Siobhan Tully | cf04fb6 | 2014-01-11 11:25:57 -0500 | [diff] [blame] | 172 | 'ADMIN_NAME': 'OpenCloud', |
Siobhan Tully | bfd11dc | 2013-09-03 12:59:24 -0400 | [diff] [blame] | 173 | # 'HEADER_DATE_FORMAT': 'l, j. F Y', |
| 174 | # 'HEADER_TIME_FORMAT': 'H:i', |
| 175 | |
| 176 | # forms |
| 177 | #'SHOW_REQUIRED_ASTERISK': True, # Default True |
| 178 | 'CONFIRM_UNSAVED_CHANGES': True, # Default True |
| 179 | |
| 180 | # menu |
| 181 | # 'SEARCH_URL': '/admin/auth/user/', |
| 182 | # 'MENU_ICONS': { |
| 183 | # 'sites': 'icon-leaf', |
| 184 | # 'auth': 'icon-lock', |
| 185 | # }, |
| 186 | # 'MENU_OPEN_FIRST_CHILD': True, # Default True |
Siobhan Tully | cf04fb6 | 2014-01-11 11:25:57 -0500 | [diff] [blame] | 187 | 'MENU_EXCLUDE': ( |
| 188 | 'auth.group', |
| 189 | 'auth', |
| 190 | 'core.network', |
| 191 | 'core.sliver', |
| 192 | 'core.node', |
| 193 | 'core.image', |
| 194 | 'core.deploymentrole', |
| 195 | 'core.siterole', |
| 196 | 'core.slicerole', |
| 197 | 'core.planetstackrole', |
| 198 | 'core.networktemplate', |
| 199 | 'core.networkparametertype', |
| 200 | 'core.router', |
| 201 | 'core.tag', |
| 202 | 'core.account', |
| 203 | 'core.invoice', |
| 204 | 'core.serviceclass', |
Siobhan Tully | bfd11dc | 2013-09-03 12:59:24 -0400 | [diff] [blame] | 205 | ), |
Siobhan Tully | cf04fb6 | 2014-01-11 11:25:57 -0500 | [diff] [blame] | 206 | 'MENU': ( |
| 207 | #{'app': 'core', 'icon':'icon-lock'}, |
| 208 | #{'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')}, |
| 209 | {'label': 'Deployments', 'icon':'icon-deployment', 'url': '/admin/core/deployment/'}, |
| 210 | {'label': 'Sites', 'icon':'icon-site', 'url': '/admin/core/site/'}, |
| 211 | {'label': 'Slices', 'icon':'icon-slice', 'url': '/admin/core/slice/'}, |
| 212 | {'label': 'Users', 'icon':'icon-user', 'url': '/admin/core/user/'}, |
Scott Baker | d219e1e | 2014-05-20 12:04:25 -0700 | [diff] [blame] | 213 | {'label': 'RequestRouter', 'icon':'icon-cog', 'app': 'requestrouter'}, |
Siobhan Tully | cf04fb6 | 2014-01-11 11:25:57 -0500 | [diff] [blame] | 214 | {'label': 'HyperCache', 'icon':'icon-cog', 'app': 'hpc'}, |
| 215 | {'label': 'Syndicate', 'icon':'icon-cog', 'app': 'syndicate'}, |
Scott Baker | d219e1e | 2014-05-20 12:04:25 -0700 | [diff] [blame] | 216 | {'label': 'Cassandra', 'icon':'icon-cog', 'app': 'cassandra'}, |
Scott Baker | 6ced3a7 | 2014-05-23 14:41:14 -0700 | [diff] [blame] | 217 | # {'label': 'KairosDB', 'icon':'icon-cog', 'app': 'kairos'}, |
| 218 | # {'label': 'Nagios', 'icon':'icon-cog', 'app': 'nagios'}, |
Scott Baker | d219e1e | 2014-05-20 12:04:25 -0700 | [diff] [blame] | 219 | |
Siobhan Tully | cf04fb6 | 2014-01-11 11:25:57 -0500 | [diff] [blame] | 220 | #{'label': 'Configured Services', 'icon':'icon-cog', 'models': [{'label': 'Content Delivery Network', 'app':'hpc'}]}, |
Siobhan Tully | bfd11dc | 2013-09-03 12:59:24 -0400 | [diff] [blame] | 221 | # 'sites', |
| 222 | # {'app': 'auth', 'icon':'icon-lock', 'models': ('user', 'group')}, |
Siobhan Tully | bfd11dc | 2013-09-03 12:59:24 -0400 | [diff] [blame] | 223 | # {'label': 'Support', 'icon':'icon-question-sign', 'url': '/support/'}, |
Siobhan Tully | cf04fb6 | 2014-01-11 11:25:57 -0500 | [diff] [blame] | 224 | # {'label': 'Settings', 'icon':'icon-cog', 'models': ('core.user', 'core.site')}, |
Siobhan Tully | bfd11dc | 2013-09-03 12:59:24 -0400 | [diff] [blame] | 225 | # ), |
Siobhan Tully | cf04fb6 | 2014-01-11 11:25:57 -0500 | [diff] [blame] | 226 | ), |
Siobhan Tully | bfd11dc | 2013-09-03 12:59:24 -0400 | [diff] [blame] | 227 | |
| 228 | # misc |
| 229 | # 'LIST_PER_PAGE': 15 |
| 230 | } |
| 231 | |
Tony Mack | 7130ac3 | 2013-03-22 21:58:00 -0400 | [diff] [blame] | 232 | # A sample logging configuration. The only tangible logging |
| 233 | # performed by this configuration is to send an email to |
| 234 | # the site admins on every HTTP 500 error when DEBUG=False. |
| 235 | # See http://docs.djangoproject.com/en/dev/topics/logging for |
| 236 | # more details on how to customize your logging configuration. |
| 237 | LOGGING = { |
| 238 | 'version': 1, |
| 239 | 'disable_existing_loggers': False, |
| 240 | 'filters': { |
| 241 | 'require_debug_false': { |
| 242 | '()': 'django.utils.log.RequireDebugFalse' |
| 243 | } |
| 244 | }, |
| 245 | 'handlers': { |
| 246 | 'mail_admins': { |
| 247 | 'level': 'ERROR', |
| 248 | 'filters': ['require_debug_false'], |
| 249 | 'class': 'django.utils.log.AdminEmailHandler' |
| 250 | } |
| 251 | }, |
| 252 | 'loggers': { |
| 253 | 'django.request': { |
| 254 | 'handlers': ['mail_admins'], |
| 255 | 'level': 'ERROR', |
| 256 | 'propagate': True, |
| 257 | }, |
| 258 | } |
| 259 | } |
Scott Baker | c40941b | 2014-04-25 12:20:47 -0700 | [diff] [blame] | 260 | |
| 261 | BIGQUERY_TABLE = getattr(config, "bigquery_table", "demoevents") |
Scott Baker | a226eb4 | 2014-06-09 11:55:26 -0700 | [diff] [blame] | 262 | |
| 263 | DISABLE_MINIDASHBOARD = getattr(config, "gui_disable_minidashboard", False) |