aea257b9eac759dc870d0208b0b4987ba9193ff8
[flowspy] / settings.py.dist
1 # Django settings for flowspy project.
2 # -*- coding: utf-8 -*- vim:fileencoding=utf-8:
3 # vim: tabstop=4:shiftwidth=4:softtabstop=4:expandtab
4 #Copyright © 2011-2013 Greek Research and Technology Network (GRNET S.A.)
5
6 #Developed by Leonidas Poulopoulos (leopoul-at-noc-dot-grnet-dot-gr),
7 #GRNET NOC
8 #
9 #Permission to use, copy, modify, and/or distribute this software for any
10 #purpose with or without fee is hereby granted, provided that the above
11 #copyright notice and this permission notice appear in all copies.
12 #
13 #THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD
14 #TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
15 #FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
16 #CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
17 #DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
18 #ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
19 #SOFTWARE.
20 #
21
22
23 import os
24 import djcelery
25 djcelery.setup_loader()
26 from celery.schedules import crontab
27 DEBUG = False
28 TEMPLATE_DEBUG = DEBUG
29
30 ADMINS = (
31     ('AdminName', 'adminmail@admin.com'),
32 )
33
34 here = lambda x: os.path.join(os.path.abspath(os.path.dirname(__file__)), x)
35
36
37
38 MANAGERS = ADMINS
39
40 DATABASES = {
41     'default': {
42         'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
43         'NAME': 'flowspec',                      # Or path to database file if using sqlite3.
44         'USER': '',                      # Not used with sqlite3.
45         'PASSWORD': '',                  # Not used with sqlite3.
46         'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
47         'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
48         'OPTIONS':  {
49         "init_command": "SET storage_engine=MYISAM",
50         }
51     }
52 }
53
54 # Local time zone for this installation. Choices can be found here:
55 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
56 # although not all choices may be available on all operating systems.
57 # On Unix systems, a value of None will cause Django to use the same
58 # timezone as the operating system.
59 # If running in a Windows environment this must be set to the same as your
60 # system time zone.
61 TIME_ZONE = 'Europe/Athens'
62
63 # Language code for this installation. All choices can be found here:
64 # http://www.i18nguy.com/unicode/language-identifiers.html
65 _ = lambda s: s
66
67 LANGUAGES = (
68     ('el', _('Greek')),
69     ('en', _('English')),
70 )
71
72 # Language code for this installation. All choices can be found here:
73 # http://www.i18nguy.com/unicode/language-identifiers.html
74 LANGUAGE_CODE = 'en'
75
76 SITE_ID = 1
77
78 # If you set this to False, Django will make some optimizations so as not
79 # to load the internationalization machinery.
80 USE_I18N = True
81
82 # If you set this to False, Django will not format dates, numbers and
83 # calendars according to the current locale
84 USE_L10N = True
85
86 # Absolute path to the directory that holds media.
87 # Example: "/home/media/media.lawrence.com/"
88 MEDIA_ROOT = ''
89
90 # URL that handles the media served from MEDIA_ROOT. Make sure to use a
91 # trailing slash if there is a path component (optional in other cases).
92 # Examples: "http://media.lawrence.com", "http://example.com/media/"
93 MEDIA_URL = ''
94
95 # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
96 # trailing slash.
97 # Examples: "http://foo.com/media/", "/media/".
98 ADMIN_MEDIA_PREFIX = '/admin/media/'
99
100 # Make this unique, and don't share it with anybody.
101 SECRET_KEY = 'fju0e4zu-thi7qf@93voi5eeot21@a*e54)%89xe-7iorqcimk'
102
103 # List of callables that know how to import templates from various sources.
104 TEMPLATE_LOADERS = (
105     'django.template.loaders.filesystem.Loader',
106     'django.template.loaders.app_directories.Loader',
107 #     'django.template.loaders.eggs.Loader',
108 )
109
110 TEMPLATE_CONTEXT_PROCESSORS = (
111     "django.contrib.auth.context_processors.auth",
112     "django.core.context_processors.debug",
113     "django.core.context_processors.i18n",
114     "django.core.context_processors.media",
115     "django.contrib.messages.context_processors.messages"
116 )
117
118 MIDDLEWARE_CLASSES = (
119     'django.middleware.cache.UpdateCacheMiddleware',
120     'django.middleware.common.CommonMiddleware',
121     'django.contrib.sessions.middleware.SessionMiddleware',
122     'django.middleware.locale.LocaleMiddleware',
123     'django.middleware.csrf.CsrfViewMiddleware',
124     'django.contrib.auth.middleware.AuthenticationMiddleware',
125     'django.contrib.messages.middleware.MessageMiddleware',
126     'django.middleware.cache.FetchFromCacheMiddleware',
127     'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
128 )
129
130 AUTHENTICATION_BACKENDS = (
131     'flowspy.djangobackends.shibauthBackend.shibauthBackend',
132     'django.contrib.auth.backends.ModelBackend',
133 )
134
135 ROOT_URLCONF = 'flowspy.urls'
136
137 STATIC_URL = '/path/to/static'
138
139 TEMPLATE_DIRS = (
140     '/path/to/templates/',
141     # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
142     # Always use forward slashes, even on Windows.
143     # Don't forget to use absolute paths, not relative paths.
144 )
145
146 INSTALLED_APPS = (
147     'monkey_patch',
148     'django.contrib.auth',
149     'django.contrib.contenttypes',
150     'django.contrib.sessions',
151     'django.contrib.sites',
152     'django.contrib.messages',
153     'django.contrib.flatpages',
154     'flowspec',
155     'poller',
156     'south',
157     # Uncomment the next line to enable the admin:
158     'django.contrib.admin',
159     # Uncomment the next line to enable admin documentation:
160     'django.contrib.admindocs',
161     'django_extensions',
162     'djcelery',
163     'peers',
164         'registration',
165     'accounts',
166     'tinymce',
167 )
168
169 LOGIN_URL = '/fod/welcome'
170
171 CACHE_BACKEND = "memcached://127.0.0.1:11211/?timeout=3600"
172
173 AUTH_PROFILE_MODULE = 'accounts.UserProfile'
174
175 NETCONF_DEVICE = ""
176 NETCONF_USER = ""
177 NETCONF_PASS = ""
178 ROUTES_FILTER = "<configuration><routing-options><flow/></routing-options></configuration>"
179 ROUTE_FILTER = "<configuration><routing-options><flow><route><name>%s</name></route></flow></routing-options></configuration>"
180 COMMIT_CONFIRMED_TIMEOUT = "120"
181 EXPIRATION_DAYS_OFFSET = 7
182 COMMIT = True
183
184 USE_X_FORWARDED_HOST = True
185
186 BROKER_HOST = "localhost"
187 BROKER_PORT = 11300
188 POLLS_TUBE = 'polls'
189
190 BROKER_VHOST = "/"
191 CELERY_CONCURRENCY = 1
192
193 # List of modules to import when celery starts.
194 CELERY_IMPORTS = ("flowspec.tasks", )
195
196 SERVER_EMAIL = "GRNET FoD Service <noreply@grnet.gr>"
197 EMAIL_SUBJECT_PREFIX = "[FoD] "
198
199 LOG_FILE_LOCATION = here("log")
200
201 EXPIRATION_NOTIFY_DAYS = 4
202 PREFIX_LENGTH = 29 
203 POLL_SESSION_UPDATE = 60.0
204
205 BROKER_URL = "beanstalk://localhost:11300//"
206
207 SHIB_AUTH_ENTITLEMENT = 'urn:mace'
208 SHIB_ADMIN_DOMAIN = 'grnet.gr'
209 SHIB_LOGOUT_URL = 'https://example.com/Shibboleth.sso/Logout'
210
211 # BCC mail addresses
212 NOTIFY_ADMIN_MAILS = ["admin@admin.com"]
213
214 UI_USER_THEN_ACTIONS = ['discard', 'rate-limit']
215 UI_USER_PROTOCOLS = ['icmp', 'tcp', 'udp']
216
217 PROTECTED_SUBNETS = ['10.10.0.0/16']
218
219 CELERYBEAT_SCHEDULE = { 
220     "every-day-sync": {
221         "task": "flowspec.tasks.check_sync",
222         "schedule": crontab(minute=01, hour=01),
223         "args": (),
224     },
225     "notify-expired": {
226         "task": "flowspec.tasks.notify_expired",
227         "schedule": crontab(minute=01, hour=02),
228         "args": (),
229     },
230 }
231 # whois
232 PRIMARY_WHOIS = 'whois.grnet.gr'
233 ALTERNATE_WHOIS = 'whois.ripe.net'
234
235 ACCOUNT_ACTIVATION_DAYS = 7
236
237 #Shibboleth attribute map
238 SHIB_USERNAME = ['HTTP_EPPN']
239 SHIB_MAIL = ['mail', 'HTTP_MAIL', 'HTTP_SHIB_INETORGPERSON_MAIL']
240 SHIB_FIRSTNAME = ['HTTP_SHIB_INETORGPERSON_GIVENNAME']
241 SHIB_LASTNAME = ['HTTP_SHIB_PERSON_SURNAME']
242 SHIB_ENTITLEMENT = ['HTTP_SHIB_EP_ENTITLEMENT']
243
244 TINYMCE_JS_URL = '/fodstatic/js/tinymce/tiny_mce.js'
245
246 TINYMCE_DEFAULT_CONFIG = {
247     'extended_valid_elements' :  'iframe[src|width|height|name|align]',
248     'plugins': "table,spellchecker,paste,searchreplace",
249     'theme': "advanced",
250 }
251
252