Statistics
| Branch: | Tag: | Revision:

root / flowspy / settings.py.dist @ 243819e7

History | View | Annotate | Download (10.6 kB)

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
# Permission to use, copy, modify, and/or distribute this software for any
9
# purpose with or without fee is hereby granted, provided that the above
10
# copyright notice and this permission notice appear in all copies.
11
#
12
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
13
# TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
14
# FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
15
# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
16
# DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
17
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
18
# SOFTWARE.
19

    
20
import os
21
import djcelery
22
djcelery.setup_loader()
23
from celery.schedules import crontab
24

    
25
DEBUG = False
26
TEMPLATE_DEBUG = DEBUG
27

    
28
ADMINS = (
29
    ('AdminName', 'adminmail@admin.com'),
30
)
31
MANAGERS = ADMINS
32
here = lambda x: os.path.join(os.path.abspath(os.path.dirname(__file__)), x)
33

    
34

    
35
DATABASES = {
36
    'default': {
37
        'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
38
        'NAME': '',                      # Or path to database file if using sqlite3.
39
        'USER': '',                      # Not used with sqlite3.
40
        'PASSWORD': '',                  # Not used with sqlite3.
41
        'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
42
        'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
43
    }
44
}
45

    
46
# Hosts/domain names that are valid for this site; required if DEBUG is False
47
# See https://docs.djangoproject.com/en/1.4/ref/settings/#allowed-hosts
48
ALLOWED_HOSTS = []
49

    
50
# Local time zone for this installation. Choices can be found here:
51
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
52
# although not all choices may be available on all operating systems.
53
# In a Windows environment this must be set to your system time zone.
54
TIME_ZONE = 'Europe/Athens'
55

    
56
# Language code for this installation. All choices can be found here:
57
# http://www.i18nguy.com/unicode/language-identifiers.html
58
_ = lambda s: s
59

    
60
LANGUAGES = (
61
    ('el', _('Greek')),
62
    ('en', _('English')),
63
)
64

    
65
# Language code for this installation. All choices can be found here:
66
# http://www.i18nguy.com/unicode/language-identifiers.html
67
LANGUAGE_CODE = 'en'
68

    
69
LOCALE_PATHS = (
70
    os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'locale'),
71
)
72

    
73
SITE_ID = 1
74

    
75
# If you set this to False, Django will make some optimizations so as not
76
# to load the internationalization machinery.
77
USE_I18N = True
78

    
79
# If you set this to False, Django will not format dates, numbers and
80
# calendars according to the current locale.
81
USE_L10N = True
82

    
83
# If you set this to False, Django will not use timezone-aware datetimes.
84
USE_TZ = True
85

    
86
# Absolute filesystem path to the directory that will hold user-uploaded files.
87
# Example: "/home/media/media.lawrence.com/media/"
88
MEDIA_ROOT = ''
89

    
90
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
91
# trailing slash.
92
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
93
MEDIA_URL = ''
94

    
95
# Absolute path to the directory static files should be collected to.
96
# Don't put anything in this directory yourself; store your static files
97
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
98
# Example: "/home/media/media.lawrence.com/static/"
99
STATIC_ROOT = '/path/to/projects/flowspy/static'
100

    
101
# URL prefix for static files.
102
# Example: "http://media.lawrence.com/static/"
103
STATIC_URL = 'https://example.com/static/'
104

    
105
# Additional locations of static files
106
STATICFILES_DIRS = (
107
    # Put strings here, like "/home/html/static" or "C:/www/django/static".
108
    # Always use forward slashes, even on Windows.
109
    # Don't forget to use absolute paths, not relative paths.
110
)
111

    
112
# List of finder classes that know how to find static files in
113
# various locations.
114
STATICFILES_FINDERS = (
115
    'django.contrib.staticfiles.finders.FileSystemFinder',
116
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
117
#    'django.contrib.staticfiles.finders.DefaultStorageFinder',
118
)
119

    
120
# Make this unique, and don't share it with anybody.
121
SECRET_KEY = '<PLACE RANDOM CHARS HERE>eg. @@5234#$%345345^@#$%*()123^@12!&!()$JMNDF#$@(@#8FRNJWX_'
122

    
123
# List of callables that know how to import templates from various sources.
124
TEMPLATE_LOADERS = (
125
    'django.template.loaders.filesystem.Loader',
126
    'django.template.loaders.app_directories.Loader',
127
#     'django.template.loaders.eggs.Loader',
128
)
129

    
130
TEMPLATE_CONTEXT_PROCESSORS = (
131
    "django.contrib.auth.context_processors.auth",
132
    "django.core.context_processors.debug",
133
    "django.core.context_processors.i18n",
134
    "django.core.context_processors.media",
135
    "django.core.context_processors.static",
136
    "django.contrib.messages.context_processors.messages",
137
    "context.global_vars.settings_vars",
138
)
139

    
140
MIDDLEWARE_CLASSES = (
141
    'django.middleware.cache.UpdateCacheMiddleware',
142
    'django.middleware.common.CommonMiddleware',
143
    'django.contrib.sessions.middleware.SessionMiddleware',
144
    'django.middleware.locale.LocaleMiddleware',
145
    'django.middleware.csrf.CsrfViewMiddleware',
146
    'django.contrib.auth.middleware.AuthenticationMiddleware',
147
    'django.contrib.messages.middleware.MessageMiddleware',
148
    # Uncomment the next line for simple clickjacking protection:
149
    # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
150
    'django.middleware.cache.FetchFromCacheMiddleware',
151
    'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
152
)
153

    
154
ROOT_URLCONF = 'flowspy.urls'
155

    
156
# Python dotted path to the WSGI application used by Django's runserver.
157
WSGI_APPLICATION = 'flowspy.wsgi.application'
158

    
159
AUTHENTICATION_BACKENDS = (
160
    'djangobackends.shibauthBackend.shibauthBackend',
161
    'django.contrib.auth.backends.ModelBackend',
162
)
163

    
164
TEMPLATE_DIRS = (
165
	'/path/to/templates/',
166
    '/path/to/rest_framework/templates/',
167
    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
168
    # Always use forward slashes, even on Windows.
169
    # Don't forget to use absolute paths, not relative paths.
170
)
171

    
172
INSTALLED_APPS = (
173
    'longerusername',
174
    'django.contrib.auth',
175
    'django.contrib.contenttypes',
176
    'django.contrib.sessions',
177
    'django.contrib.sites',
178
    'django.contrib.flatpages',
179
    'django.contrib.messages',
180
    'django.contrib.staticfiles',
181
    'flowspec',
182
    'poller',
183
    'south',
184
    # Uncomment the next line to enable the admin:
185
    'django.contrib.admin',
186
    # Uncomment the next line to enable admin documentation:
187
    # 'django.contrib.admindocs',
188
    'djcelery',
189
    'peers',
190
	'registration',
191
    'accounts',
192
    'tinymce',
193
    'widget_tweaks',
194
)
195

    
196
# A sample logging configuration. The only tangible logging
197
# performed by this configuration is to send an email to
198
# the site admins on every HTTP 500 error when DEBUG=False.
199
# See http://docs.djangoproject.com/en/dev/topics/logging for
200
# more details on how to customize your logging configuration.
201
LOGGING = {
202
    'version': 1,
203
    'disable_existing_loggers': False,
204
    'filters': {
205
        'require_debug_false': {
206
            '()': 'django.utils.log.RequireDebugFalse'
207
        }
208
    },
209
    'handlers': {
210
        'mail_admins': {
211
            'level': 'ERROR',
212
            'filters': ['require_debug_false'],
213
            'class': 'django.utils.log.AdminEmailHandler'
214
        }
215
    },
216
    'loggers': {
217
        'django.request': {
218
            'handlers': ['mail_admins'],
219
            'level': 'ERROR',
220
            'propagate': True,
221
        },
222
    }
223
}
224

    
225
LOGIN_URL = '/welcome'
226

    
227
# CACHES = {
228
#     'default': {
229
#         'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
230
#         'LOCATION': '127.0.0.1:11211',
231
#     }
232
# }
233
CACHES = {
234
    'default': {
235
        'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
236
    }
237
}
238

    
239
AUTH_PROFILE_MODULE = 'accounts.UserProfile'
240

    
241
NETCONF_DEVICE = ""
242
NETCONF_USER = ""
243
NETCONF_PASS = ""
244
NETCONF_PORT = 830
245

    
246
ROUTES_FILTER = "<configuration><routing-options><flow/></routing-options></configuration>"
247
ROUTE_FILTER = "<configuration><routing-options><flow><route><name>%s</name></route></flow></routing-options></configuration>"
248
COMMIT_CONFIRMED_TIMEOUT = "120"
249
EXPIRATION_DAYS_OFFSET = 7
250
COMMIT = True
251

    
252
USE_X_FORWARDED_HOST = True
253

    
254
BROKER_HOST = "localhost"
255
BROKER_PORT = 11300
256
POLLS_TUBE = 'polls'
257

    
258
BROKER_VHOST = "/"
259
CELERY_CONCURRENCY = 1
260

    
261
# List of modules to import when celery starts.
262
CELERY_IMPORTS = ("flowspec.tasks", )
263

    
264
SERVER_EMAIL = "Example FoD Service <noreply@example.com>"
265
EMAIL_SUBJECT_PREFIX = "[FoD] "
266

    
267
EXPIRATION_NOTIFY_DAYS = 4
268
PREFIX_LENGTH = 29
269
POLL_SESSION_UPDATE = 60.0
270

    
271
BROKER_URL = "beanstalk://localhost:11300//"
272

    
273
SHIB_AUTH_ENTITLEMENT = 'urn:mace'
274
SHIB_ADMIN_DOMAIN = 'grnet.gr'
275
SHIB_LOGOUT_URL = 'https://example.com/Shibboleth.sso/Logout'
276

    
277
# BCC mail addresses
278
NOTIFY_ADMIN_MAILS = ["admin@admin.com"]
279

    
280
UI_USER_THEN_ACTIONS = ['discard', 'rate-limit']
281
UI_USER_PROTOCOLS = ['icmp', 'tcp', 'udp']
282

    
283
PROTECTED_SUBNETS = ['10.10.0.0/16']
284

    
285
CELERYBEAT_SCHEDULE = {
286
    "every-day-sync": {
287
        "task": "flowspec.tasks.check_sync",
288
        "schedule": crontab(minute=01, hour=01),
289
        "args": (),
290
    },
291
    "notify-expired": {
292
        "task": "flowspec.tasks.notify_expired",
293
        "schedule": crontab(minute=01, hour=02),
294
        "args": (),
295
    },
296
}
297
# whois
298
PRIMARY_WHOIS = 'whois.example.com'
299
ALTERNATE_WHOIS = 'whois.example.net'
300

    
301
ACCOUNT_ACTIVATION_DAYS = 7
302

    
303
#Shibboleth attribute map
304
SHIB_USERNAME = ['HTTP_EPPN']
305
SHIB_SLUGIFY_USERNAME = False
306

    
307
SHIB_MAIL = ['mail', 'HTTP_MAIL', 'HTTP_SHIB_INETORGPERSON_MAIL']
308
SHIB_FIRSTNAME = ['HTTP_SHIB_INETORGPERSON_GIVENNAME']
309
SHIB_LASTNAME = ['HTTP_SHIB_PERSON_SURNAME']
310
SHIB_ENTITLEMENT = ['HTTP_SHIB_EP_ENTITLEMENT']
311

    
312
TINYMCE_JS_URL = STATIC_URL +'js/tinymce/tiny_mce.js'
313

    
314
TINYMCE_DEFAULT_CONFIG = {
315
    'extended_valid_elements' :  'iframe[src|width|height|name|align]',
316
    'plugins': "table,spellchecker,paste,searchreplace",
317
    'theme': "advanced",
318
}
319

    
320
import _version
321
SW_VERSION = _version.VERSION
322

    
323
LOG_FILE_LOCATION = "/var/log/fod"
324

    
325
# Change the following values only if you know what you are doing!!!
326
# To integrate FoD with tables (Peer, Networks, Contacts)
327
# from your CRM platform, set the following values to False and create the views that are
328
# exact matches of the tables in peers/models.py
329
PEER_MANAGED_TABLE = True
330
PEER_RANGE_MANAGED_TABLE = True
331
PEER_TECHC_MANAGED_TABLE = True
332

    
333