Merge branch 'dev' of https://github.com/grnet/flowspy into dev
[flowspy] / flowspy / settings.py.dist
1 # -*- coding: utf-8 -*- vim:fileencoding=utf-8:
2 # vim: tabstop=4:shiftwidth=4:softtabstop=4:expandtab
3 # Django settings for flowspy project.
4 # Copyright © 2011-2015 Greek Research and Technology Network (GRNET S.A.)
5 # Copyright © 2011-2014 Leonidas Poulopoulos (@leopoul)
6 # Copyright © 2014-2015 Stavros Kroustouris (@kroustou)
7 #
8 # This program is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation, either version 3 of the License, or
11 # (at your option) any later version.
12 #
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
20 #
21
22 import os
23 import djcelery
24 djcelery.setup_loader()
25 from celery.schedules import crontab
26
27 DEBUG = False
28 TEMPLATE_DEBUG = DEBUG
29
30 ADMINS = (
31     ('AdminName', 'adminmail@admin.com'),
32 )
33 MANAGERS = ADMINS
34 here = lambda x: os.path.join(os.path.abspath(os.path.dirname(__file__)), x)
35
36
37 DATABASES = {
38     'default': {
39         'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
40         'NAME': '',                      # Or path to database file if using sqlite3.
41         'USER': '',                      # Not used with sqlite3.
42         'PASSWORD': '',                  # Not used with sqlite3.
43         'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
44         'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
45     }
46 }
47
48 # Hosts/domain names that are valid for this site; required if DEBUG is False
49 # See https://docs.djangoproject.com/en/1.4/ref/settings/#allowed-hosts
50 ALLOWED_HOSTS = []
51
52 # Local time zone for this installation. Choices can be found here:
53 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
54 # although not all choices may be available on all operating systems.
55 # In a Windows environment this must be set to your system time zone.
56 TIME_ZONE = 'Europe/Athens'
57
58 # Language code for this installation. All choices can be found here:
59 # http://www.i18nguy.com/unicode/language-identifiers.html
60 _ = lambda s: s
61
62 LANGUAGES = (
63     ('el', _('Greek')),
64     ('en', _('English')),
65 )
66
67 # Language code for this installation. All choices can be found here:
68 # http://www.i18nguy.com/unicode/language-identifiers.html
69 LANGUAGE_CODE = 'en'
70
71 LOCALE_PATHS = (
72     os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'locale'),
73 )
74
75 SITE_ID = 1
76
77 # If you set this to False, Django will make some optimizations so as not
78 # to load the internationalization machinery.
79 USE_I18N = True
80
81 # If you set this to False, Django will not format dates, numbers and
82 # calendars according to the current locale.
83 USE_L10N = True
84
85 # If you set this to False, Django will not use timezone-aware datetimes.
86 USE_TZ = True
87
88 # Absolute filesystem path to the directory that will hold user-uploaded files.
89 # Example: "/home/media/media.lawrence.com/media/"
90 MEDIA_ROOT = ''
91
92 # URL that handles the media served from MEDIA_ROOT. Make sure to use a
93 # trailing slash.
94 # Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
95 MEDIA_URL = ''
96
97 # Absolute path to the directory static files should be collected to.
98 # Don't put anything in this directory yourself; store your static files
99 # in apps' "static/" subdirectories and in STATICFILES_DIRS.
100 # Example: "/home/media/media.lawrence.com/static/"
101 STATIC_ROOT = '/path/to/projects/flowspy/static'
102
103 # URL prefix for static files.
104 # Example: "http://media.lawrence.com/static/"
105 STATIC_URL = 'https://example.com/static/'
106
107 # Additional locations of static files
108 STATICFILES_DIRS = (
109     # Put strings here, like "/home/html/static" or "C:/www/django/static".
110     # Always use forward slashes, even on Windows.
111     # Don't forget to use absolute paths, not relative paths.
112 )
113
114 # List of finder classes that know how to find static files in
115 # various locations.
116 STATICFILES_FINDERS = (
117     'django.contrib.staticfiles.finders.FileSystemFinder',
118     'django.contrib.staticfiles.finders.AppDirectoriesFinder',
119 #    'django.contrib.staticfiles.finders.DefaultStorageFinder',
120 )
121
122 # Make this unique, and don't share it with anybody.
123 SECRET_KEY = '<PLACE RANDOM CHARS HERE>eg. @@5234#$%345345^@#$%*()123^@12!&!()$JMNDF#$@(@#8FRNJWX_'
124
125 # List of callables that know how to import templates from various sources.
126 TEMPLATE_LOADERS = (
127     'django.template.loaders.filesystem.Loader',
128     'django.template.loaders.app_directories.Loader',
129 #     'django.template.loaders.eggs.Loader',
130 )
131
132 TEMPLATE_CONTEXT_PROCESSORS = (
133     "django.contrib.auth.context_processors.auth",
134     "django.core.context_processors.debug",
135     "django.core.context_processors.i18n",
136     "django.core.context_processors.media",
137     "django.core.context_processors.static",
138     "django.contrib.messages.context_processors.messages",
139     "context.global_vars.settings_vars",
140 )
141
142 MIDDLEWARE_CLASSES = (
143     'django.middleware.cache.UpdateCacheMiddleware',
144     'django.middleware.common.CommonMiddleware',
145     'django.contrib.sessions.middleware.SessionMiddleware',
146     'django.middleware.locale.LocaleMiddleware',
147     'django.middleware.csrf.CsrfViewMiddleware',
148     'django.contrib.auth.middleware.AuthenticationMiddleware',
149     'django.contrib.messages.middleware.MessageMiddleware',
150     # Uncomment the next line for simple clickjacking protection:
151     # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
152     'django.middleware.cache.FetchFromCacheMiddleware',
153     'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
154 )
155
156 ROOT_URLCONF = 'flowspy.urls'
157
158 # Python dotted path to the WSGI application used by Django's runserver.
159 WSGI_APPLICATION = 'flowspy.wsgi.application'
160
161 AUTHENTICATION_BACKENDS = (
162     'djangobackends.shibauthBackend.shibauthBackend',
163     'django.contrib.auth.backends.ModelBackend',
164 )
165
166 TEMPLATE_DIRS = (
167         '/path/to/templates/',
168     '/path/to/rest_framework/templates/',
169     # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
170     # Always use forward slashes, even on Windows.
171     # Don't forget to use absolute paths, not relative paths.
172 )
173
174 INSTALLED_APPS = (
175     'longerusername',
176     'django.contrib.auth',
177     'django.contrib.contenttypes',
178     'django.contrib.sessions',
179     'django.contrib.sites',
180     'django.contrib.flatpages',
181     'django.contrib.messages',
182     'django.contrib.staticfiles',
183     'flowspec',
184     'poller',
185     'south',
186     # Uncomment the next line to enable the admin:
187     'django.contrib.admin',
188     # Uncomment the next line to enable admin documentation:
189     # 'django.contrib.admindocs',
190     'djcelery',
191     'peers',
192     'rest_framework',
193         'registration',
194     'accounts',
195     'tinymce',
196     'widget_tweaks',
197 )
198
199 # A sample logging configuration. The only tangible logging
200 # performed by this configuration is to send an email to
201 # the site admins on every HTTP 500 error when DEBUG=False.
202 # See http://docs.djangoproject.com/en/dev/topics/logging for
203 # more details on how to customize your logging configuration.
204 LOGGING = {
205     'version': 1,
206     'disable_existing_loggers': False,
207     'filters': {
208         'require_debug_false': {
209             '()': 'django.utils.log.RequireDebugFalse'
210         }
211     },
212     'handlers': {
213         'mail_admins': {
214             'level': 'ERROR',
215             'filters': ['require_debug_false'],
216             'class': 'django.utils.log.AdminEmailHandler'
217         }
218     },
219     'loggers': {
220         'django.request': {
221             'handlers': ['mail_admins'],
222             'level': 'ERROR',
223             'propagate': True,
224         },
225     }
226 }
227
228 LOGIN_URL = '/welcome'
229
230 # CACHES = {
231 #     'default': {
232 #         'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
233 #         'LOCATION': '127.0.0.1:11211',
234 #     }
235 # }
236 CACHES = {
237     'default': {
238         'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
239     }
240 }
241
242 AUTH_PROFILE_MODULE = 'accounts.UserProfile'
243
244 NETCONF_DEVICE = ""
245 NETCONF_USER = ""
246 NETCONF_PASS = ""
247 NETCONF_PORT = 830
248
249 ROUTES_FILTER = "<configuration><routing-options><flow/></routing-options></configuration>"
250 ROUTE_FILTER = "<configuration><routing-options><flow><route><name>%s</name></route></flow></routing-options></configuration>"
251 COMMIT_CONFIRMED_TIMEOUT = "120"
252 EXPIRATION_DAYS_OFFSET = 7
253 COMMIT = True
254
255 USE_X_FORWARDED_HOST = True
256
257 BROKER_HOST = "localhost"
258 BROKER_PORT = 11300
259 POLLS_TUBE = 'polls'
260
261 BROKER_VHOST = "/"
262 CELERY_CONCURRENCY = 1
263
264 # List of modules to import when celery starts.
265 CELERY_IMPORTS = ("flowspec.tasks", )
266
267 SERVER_EMAIL = "Example FoD Service <noreply@example.com>"
268 EMAIL_SUBJECT_PREFIX = "[FoD] "
269
270 EXPIRATION_NOTIFY_DAYS = 4
271 PREFIX_LENGTH = 29
272 POLL_SESSION_UPDATE = 60.0
273
274 BROKER_URL = "beanstalk://localhost:11300//"
275
276 SHIB_AUTH_ENTITLEMENT = 'urn:mace'
277 SHIB_ADMIN_DOMAIN = 'grnet.gr'
278 SHIB_LOGOUT_URL = 'https://example.com/Shibboleth.sso/Logout'
279
280 # BCC mail addresses
281 NOTIFY_ADMIN_MAILS = ["admin@admin.com"]
282
283 UI_USER_THEN_ACTIONS = ['discard', 'rate-limit']
284 UI_USER_PROTOCOLS = ['icmp', 'tcp', 'udp']
285
286 PROTECTED_SUBNETS = ['10.10.0.0/16']
287
288 CELERYBEAT_SCHEDULE = {
289     "every-day-sync": {
290         "task": "flowspec.tasks.check_sync",
291         "schedule": crontab(minute=01, hour=01),
292         "args": (),
293     },
294     "notify-expired": {
295         "task": "flowspec.tasks.notify_expired",
296         "schedule": crontab(minute=01, hour=02),
297         "args": (),
298     },
299 }
300 # whois
301 PRIMARY_WHOIS = 'whois.example.com'
302 ALTERNATE_WHOIS = 'whois.example.net'
303
304 ACCOUNT_ACTIVATION_DAYS = 7
305
306 #Shibboleth attribute map
307 SHIB_USERNAME = ['HTTP_EPPN']
308 SHIB_SLUGIFY_USERNAME = False
309
310 SHIB_MAIL = ['mail', 'HTTP_MAIL', 'HTTP_SHIB_INETORGPERSON_MAIL']
311 SHIB_FIRSTNAME = ['HTTP_SHIB_INETORGPERSON_GIVENNAME']
312 SHIB_LASTNAME = ['HTTP_SHIB_PERSON_SURNAME']
313 SHIB_ENTITLEMENT = ['HTTP_SHIB_EP_ENTITLEMENT']
314
315 TINYMCE_JS_URL = STATIC_URL +'js/tinymce/tiny_mce.js'
316
317 TINYMCE_DEFAULT_CONFIG = {
318     'extended_valid_elements' :  'iframe[src|width|height|name|align]',
319     'plugins': "table,spellchecker,paste,searchreplace",
320     'theme': "advanced",
321 }
322
323 import _version
324 SW_VERSION = _version.VERSION
325
326 LOG_FILE_LOCATION = "/var/log/fod"
327
328 # Change the following values only if you know what you are doing!!!
329 # To integrate FoD with tables (Peer, Networks, Contacts)
330 # from your CRM platform, set the following values to False and create the views that are
331 # exact matches of the tables in peers/models.py
332 PEER_MANAGED_TABLE = True
333 PEER_RANGE_MANAGED_TABLE = True
334 PEER_TECHC_MANAGED_TABLE = True
335
336