Siobhan Tully | bfd11dc | 2013-09-03 12:59:24 -0400 | [diff] [blame] | 1 | from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS as TCP |
| 2 | |
Tony Mack | 7130ac3 | 2013-03-22 21:58:00 -0400 | [diff] [blame] | 3 | # Django settings for planetstack project. |
Tony Mack | e485af3 | 2013-05-10 17:15:32 -0400 | [diff] [blame] | 4 | from config import Config |
| 5 | config = Config() |
Scott Baker | 8a867eb | 2014-04-22 13:50:26 -0700 | [diff] [blame] | 6 | |
| 7 | GEOIP_PATH = "/usr/share/GeoIP" |
Scott Baker | 40695e1 | 2014-03-13 22:50:45 -0700 | [diff] [blame] | 8 | |
Tony Mack | 7130ac3 | 2013-03-22 21:58:00 -0400 | [diff] [blame] | 9 | DEBUG = True |
| 10 | TEMPLATE_DEBUG = DEBUG |
| 11 | |
| 12 | ADMINS = ( |
| 13 | # ('Your Name', 'your_email@example.com'), |
| 14 | ) |
| 15 | |
Siobhan Tully | cf04fb6 | 2014-01-11 11:25:57 -0500 | [diff] [blame] | 16 | LOGIN_REDIRECT_URL = '/admin/core/user' |
| 17 | |
Tony Mack | 7130ac3 | 2013-03-22 21:58:00 -0400 | [diff] [blame] | 18 | MANAGERS = ADMINS |
| 19 | |
| 20 | DATABASES = { |
| 21 | 'default': { |
| 22 | '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] | 23 | 'NAME': config.db_name, # Or path to database file if using sqlite3. |
Tony Mack | 7130ac3 | 2013-03-22 21:58:00 -0400 | [diff] [blame] | 24 | # The following settings are not used with sqlite3: |
Tony Mack | e485af3 | 2013-05-10 17:15:32 -0400 | [diff] [blame] | 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. |
Tony Mack | 7130ac3 | 2013-03-22 21:58:00 -0400 | [diff] [blame] | 28 | 'PORT': '', # Set to empty string for default. |
| 29 | } |
| 30 | } |
| 31 | |
Siobhan Tully | 30fd429 | 2013-05-10 08:59:56 -0400 | [diff] [blame] | 32 | AUTH_USER_MODEL = 'core.User' |
| 33 | |
Siobhan Tully | bfd11dc | 2013-09-03 12:59:24 -0400 | [diff] [blame] | 34 | |
Tony Mack | 7130ac3 | 2013-03-22 21:58:00 -0400 | [diff] [blame] | 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/" |
Scott Baker | 40695e1 | 2014-03-13 22:50:45 -0700 | [diff] [blame] | 64 | MEDIA_ROOT = '/var/www/html/files/' |
Tony Mack | 7130ac3 | 2013-03-22 21:58:00 -0400 | [diff] [blame] | 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/" |
Scott Baker | 40695e1 | 2014-03-13 22:50:45 -0700 | [diff] [blame] | 69 | MEDIA_URL = '/files/' |
Tony Mack | 7130ac3 | 2013-03-22 21:58:00 -0400 | [diff] [blame] | 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 |
Siobhan Tully | bfd11dc | 2013-09-03 12:59:24 -0400 | [diff] [blame] | 82 | STATICFILES_DIRS = ( "/opt/planetstack/core/static/", |
Tony Mack | 7130ac3 | 2013-03-22 21:58:00 -0400 | [diff] [blame] | 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 | |
Siobhan Tully | 30fd429 | 2013-05-10 08:59:56 -0400 | [diff] [blame] | 116 | ROOT_URLCONF = 'planetstack.urls' |
Tony Mack | 7130ac3 | 2013-03-22 21:58:00 -0400 | [diff] [blame] | 117 | |
| 118 | # Python dotted path to the WSGI application used by Django's runserver. |
Siobhan Tully | 30fd429 | 2013-05-10 08:59:56 -0400 | [diff] [blame] | 119 | WSGI_APPLICATION = 'planetstack.wsgi.application' |
Tony Mack | 7130ac3 | 2013-03-22 21:58:00 -0400 | [diff] [blame] | 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. |
Siobhan Tully | 30fd429 | 2013-05-10 08:59:56 -0400 | [diff] [blame] | 125 | "/opt/planetstack/templates" |
Tony Mack | 7130ac3 | 2013-03-22 21:58:00 -0400 | [diff] [blame] | 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: |
Siobhan Tully | bfd11dc | 2013-09-03 12:59:24 -0400 | [diff] [blame] | 136 | 'suit', |
Tony Mack | 7130ac3 | 2013-03-22 21:58:00 -0400 | [diff] [blame] | 137 | 'django.contrib.admin', |
| 138 | # Uncomment the next line to enable admin documentation: |
| 139 | 'django.contrib.admindocs', |
| 140 | 'rest_framework', |
| 141 | 'django_extensions', |
Tony Mack | 7130ac3 | 2013-03-22 21:58:00 -0400 | [diff] [blame] | 142 | 'django_evolution', |
Siobhan Tully | bf1153a | 2013-05-27 20:53:48 -0400 | [diff] [blame] | 143 | 'core', |
Siobhan Tully | bfd11dc | 2013-09-03 12:59:24 -0400 | [diff] [blame] | 144 | 'hpc', |
Siobhan Tully | ce652d0 | 2013-10-08 21:52:35 -0400 | [diff] [blame] | 145 | 'requestrouter', |
Siobhan Tully | cf04fb6 | 2014-01-11 11:25:57 -0500 | [diff] [blame] | 146 | 'syndicate', |
Siobhan Tully | bfd11dc | 2013-09-03 12:59:24 -0400 | [diff] [blame] | 147 | 'geoposition', |
Tony Mack | 7130ac3 | 2013-03-22 21:58:00 -0400 | [diff] [blame] | 148 | ) |
| 149 | |
Siobhan Tully | bfd11dc | 2013-09-03 12:59:24 -0400 | [diff] [blame] | 150 | |
| 151 | # Added for django-suit form |
| 152 | TEMPLATE_CONTEXT_PROCESSORS = TCP + ( |
| 153 | 'django.core.context_processors.request', |
| 154 | ) |
| 155 | |
| 156 | # Django Suit configuration example |
| 157 | SUIT_CONFIG = { |
| 158 | # header |
Siobhan Tully | cf04fb6 | 2014-01-11 11:25:57 -0500 | [diff] [blame] | 159 | 'ADMIN_NAME': 'OpenCloud', |
Siobhan Tully | bfd11dc | 2013-09-03 12:59:24 -0400 | [diff] [blame] | 160 | # 'HEADER_DATE_FORMAT': 'l, j. F Y', |
| 161 | # 'HEADER_TIME_FORMAT': 'H:i', |
| 162 | |
| 163 | # forms |
| 164 | #'SHOW_REQUIRED_ASTERISK': True, # Default True |
| 165 | 'CONFIRM_UNSAVED_CHANGES': True, # Default True |
| 166 | |
| 167 | # menu |
| 168 | # 'SEARCH_URL': '/admin/auth/user/', |
| 169 | # 'MENU_ICONS': { |
| 170 | # 'sites': 'icon-leaf', |
| 171 | # 'auth': 'icon-lock', |
| 172 | # }, |
| 173 | # 'MENU_OPEN_FIRST_CHILD': True, # Default True |
Siobhan Tully | cf04fb6 | 2014-01-11 11:25:57 -0500 | [diff] [blame] | 174 | 'MENU_EXCLUDE': ( |
| 175 | 'auth.group', |
| 176 | 'auth', |
| 177 | 'core.network', |
| 178 | 'core.sliver', |
| 179 | 'core.node', |
| 180 | 'core.image', |
| 181 | 'core.deploymentrole', |
| 182 | 'core.siterole', |
| 183 | 'core.slicerole', |
| 184 | 'core.planetstackrole', |
| 185 | 'core.networktemplate', |
| 186 | 'core.networkparametertype', |
| 187 | 'core.router', |
| 188 | 'core.tag', |
| 189 | 'core.account', |
| 190 | 'core.invoice', |
| 191 | 'core.serviceclass', |
Siobhan Tully | bfd11dc | 2013-09-03 12:59:24 -0400 | [diff] [blame] | 192 | ), |
Siobhan Tully | cf04fb6 | 2014-01-11 11:25:57 -0500 | [diff] [blame] | 193 | 'MENU': ( |
| 194 | #{'app': 'core', 'icon':'icon-lock'}, |
| 195 | #{'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')}, |
| 196 | {'label': 'Deployments', 'icon':'icon-deployment', 'url': '/admin/core/deployment/'}, |
| 197 | {'label': 'Sites', 'icon':'icon-site', 'url': '/admin/core/site/'}, |
| 198 | {'label': 'Slices', 'icon':'icon-slice', 'url': '/admin/core/slice/'}, |
| 199 | {'label': 'Users', 'icon':'icon-user', 'url': '/admin/core/user/'}, |
| 200 | {'label': 'Request Routing', 'icon':'icon-cog', 'app': 'requestrouter'}, |
| 201 | {'label': 'HyperCache', 'icon':'icon-cog', 'app': 'hpc'}, |
| 202 | {'label': 'Syndicate', 'icon':'icon-cog', 'app': 'syndicate'}, |
| 203 | #{'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] | 204 | # 'sites', |
| 205 | # {'app': 'auth', 'icon':'icon-lock', 'models': ('user', 'group')}, |
Siobhan Tully | bfd11dc | 2013-09-03 12:59:24 -0400 | [diff] [blame] | 206 | # {'label': 'Support', 'icon':'icon-question-sign', 'url': '/support/'}, |
Siobhan Tully | cf04fb6 | 2014-01-11 11:25:57 -0500 | [diff] [blame] | 207 | # {'label': 'Settings', 'icon':'icon-cog', 'models': ('core.user', 'core.site')}, |
Siobhan Tully | bfd11dc | 2013-09-03 12:59:24 -0400 | [diff] [blame] | 208 | # ), |
Siobhan Tully | cf04fb6 | 2014-01-11 11:25:57 -0500 | [diff] [blame] | 209 | ), |
Siobhan Tully | bfd11dc | 2013-09-03 12:59:24 -0400 | [diff] [blame] | 210 | |
| 211 | # misc |
| 212 | # 'LIST_PER_PAGE': 15 |
| 213 | } |
| 214 | |
Tony Mack | 7130ac3 | 2013-03-22 21:58:00 -0400 | [diff] [blame] | 215 | # A sample logging configuration. The only tangible logging |
| 216 | # performed by this configuration is to send an email to |
| 217 | # the site admins on every HTTP 500 error when DEBUG=False. |
| 218 | # See http://docs.djangoproject.com/en/dev/topics/logging for |
| 219 | # more details on how to customize your logging configuration. |
| 220 | LOGGING = { |
| 221 | 'version': 1, |
| 222 | 'disable_existing_loggers': False, |
| 223 | 'filters': { |
| 224 | 'require_debug_false': { |
| 225 | '()': 'django.utils.log.RequireDebugFalse' |
| 226 | } |
| 227 | }, |
| 228 | 'handlers': { |
| 229 | 'mail_admins': { |
| 230 | 'level': 'ERROR', |
| 231 | 'filters': ['require_debug_false'], |
| 232 | 'class': 'django.utils.log.AdminEmailHandler' |
| 233 | } |
| 234 | }, |
| 235 | 'loggers': { |
| 236 | 'django.request': { |
| 237 | 'handlers': ['mail_admins'], |
| 238 | 'level': 'ERROR', |
| 239 | 'propagate': True, |
| 240 | }, |
| 241 | } |
| 242 | } |
Scott Baker | c40941b | 2014-04-25 12:20:47 -0700 | [diff] [blame] | 243 | |
| 244 | BIGQUERY_TABLE = getattr(config, "bigquery_table", "demoevents") |