settings.py.dist 6.9 KB
Newer Older
1 2 3
# Django settings for grnet project.
# -*- coding: utf-8 -*- vim:encoding=utf-8:
# vim: tabstop=4:shiftwidth=4:softtabstop=4:expandtab
4 5 6 7
import os
import djcelery
djcelery.setup_loader()
from celery.schedules import crontab
Leonidas Poulopoulos's avatar
Leonidas Poulopoulos committed
8
DEBUG = False
9 10 11
TEMPLATE_DEBUG = DEBUG

ADMINS = (
12
    ('AdminName', 'adminmail@admin.com'),
13 14
)

15 16
here = lambda x: os.path.join(os.path.abspath(os.path.dirname(__file__)), x)

17 18


19 20 21 22
MANAGERS = ADMINS

DATABASES = {
    'default': {
Leonidas Poulopoulos's avatar
Leonidas Poulopoulos committed
23 24
        'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
        'NAME': 'flowspec',                      # Or path to database file if using sqlite3.
25 26 27 28
        'USER': '',                      # Not used with sqlite3.
        'PASSWORD': '',                  # Not used with sqlite3.
        'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
        'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
29
        'OPTIONS':  {
30
        "init_command": "SET storage_engine=MYISAM",
31
        }
32 33 34 35 36 37 38 39 40 41
    }
}

# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# On Unix systems, a value of None will cause Django to use the same
# timezone as the operating system.
# If running in a Windows environment this must be set to the same as your
# system time zone.
42 43 44 45 46 47 48 49 50 51
TIME_ZONE = 'Europe/Athens'

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

LANGUAGES = (
    ('el', _('Greek')),
    ('en', _('English')),
)
52 53 54

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
55
LANGUAGE_CODE = 'en'
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78

SITE_ID = 1

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

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

# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = ''

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash if there is a path component (optional in other cases).
# Examples: "http://media.lawrence.com", "http://example.com/media/"
MEDIA_URL = ''

# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
79
ADMIN_MEDIA_PREFIX = '/admin/media/'
80 81 82 83 84 85 86 87 88 89 90

# Make this unique, and don't share it with anybody.
SECRET_KEY = 'fju0e4zu-thi7qf@93voi5eeot21@a*e54)%89xe-7iorqcimk'

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
#     'django.template.loaders.eggs.Loader',
)

91 92 93 94 95 96 97 98
TEMPLATE_CONTEXT_PROCESSORS = (
    "django.contrib.auth.context_processors.auth",
    "django.core.context_processors.debug",
    "django.core.context_processors.i18n",
    "django.core.context_processors.media",
    "django.contrib.messages.context_processors.messages"
)

99
MIDDLEWARE_CLASSES = (
100
    'django.middleware.cache.UpdateCacheMiddleware',
101 102
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
103
    'django.middleware.locale.LocaleMiddleware',
104 105 106
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
107
    'django.middleware.cache.FetchFromCacheMiddleware',
108
    'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
109 110 111 112 113
)

AUTHENTICATION_BACKENDS = (
    'flowspy.djangobackends.shibauthBackend.shibauthBackend',
    'django.contrib.auth.backends.ModelBackend',
114 115 116 117
)

ROOT_URLCONF = 'flowspy.urls'

Leonidas Poulopoulos's avatar
Leonidas Poulopoulos committed
118
STATIC_URL = '/path/to/static'
119

120
TEMPLATE_DIRS = (
Leonidas Poulopoulos's avatar
Leonidas Poulopoulos committed
121
    '/path/to/templates/',
122 123 124 125 126 127
    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
)

INSTALLED_APPS = (
128
    'monkey_patch',
129 130 131 132 133
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
134
    'django.contrib.flatpages',
135
    'flowspec',
136
    'poller',
137
    'south',
138
    # Uncomment the next line to enable the admin:
139
    'django.contrib.admin',
140
    # Uncomment the next line to enable admin documentation:
141 142 143 144
    'django.contrib.admindocs',
    'django_extensions',
    'djcelery',
    'peers',
145
	'registration',
146 147
    'accounts',
    'tinymce',
148
)
149 150 151

LOGIN_URL = '/fod/welcome'

152
CACHE_BACKEND = "memcached://127.0.0.1:11211/?timeout=3600"
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169

AUTH_PROFILE_MODULE = 'accounts.UserProfile'

NETCONF_DEVICE = ""
NETCONF_USER = ""
NETCONF_PASS = ""
ROUTES_FILTER = "<configuration><routing-options><flow/></routing-options></configuration>"
ROUTE_FILTER = "<configuration><routing-options><flow><route><name>%s</name></route></flow></routing-options></configuration>"
COMMIT_CONFIRMED_TIMEOUT = "120"
EXPIRATION_DAYS_OFFSET = 7
COMMIT = True

USE_X_FORWARDED_HOST = True

BROKER_HOST = "localhost"
BROKER_PORT = 11300
POLLS_TUBE = 'polls'
170

171 172 173 174 175 176
BROKER_VHOST = "/"
CELERY_CONCURRENCY = 1

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

177
SERVER_EMAIL = "GRNET FoD Service <noreply@grnet.gr>"
178 179 180 181 182
EMAIL_SUBJECT_PREFIX = "[FoD] "

LOG_FILE_LOCATION = here("log")

EXPIRATION_NOTIFY_DAYS = 4
183
PREFIX_LENGTH = 29 
184
POLL_SESSION_UPDATE = 60.0
185 186 187

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

188
SHIB_AUTH_ENTITLEMENT = 'urn:mace'
189
SHIB_ADMIN_DOMAIN = 'grnet.gr'
190
SHIB_LOGOUT_URL = 'https://example.com/Shibboleth.sso/Logout'
191

Leonidas Poulopoulos's avatar
Leonidas Poulopoulos committed
192 193
# BCC mail addresses
NOTIFY_ADMIN_MAILS = ["admin@admin.com"]
194 195

UI_USER_THEN_ACTIONS = ['discard', 'rate-limit']
196
UI_USER_PROTOCOLS = ['icmp', 'tcp', 'udp']
197 198 199

PROTECTED_SUBNETS = ['10.10.0.0/16']

200
CELERYBEAT_SCHEDULE = { 
201 202
    "every-day-sync": {
        "task": "flowspec.tasks.check_sync",
203
        "schedule": crontab(minute=01, hour=01),
204 205
        "args": (),
    },
206 207 208 209 210
    "notify-expired": {
        "task": "flowspec.tasks.notify_expired",
        "schedule": crontab(minute=01, hour=02),
        "args": (),
    },
Leonidas Poulopoulos's avatar
Leonidas Poulopoulos committed
211
}
212 213 214
# whois
PRIMARY_WHOIS = 'whois.grnet.gr'
ALTERNATE_WHOIS = 'whois.ripe.net'
Leonidas Poulopoulos's avatar
Leonidas Poulopoulos committed
215

216 217 218 219 220 221 222 223 224
ACCOUNT_ACTIVATION_DAYS = 7

#Shibboleth attribute map
SHIB_USERNAME = ['HTTP_EPPN']
SHIB_MAIL = ['mail', 'HTTP_MAIL', 'HTTP_SHIB_INETORGPERSON_MAIL']
SHIB_FIRSTNAME = ['HTTP_SHIB_INETORGPERSON_GIVENNAME']
SHIB_LASTNAME = ['HTTP_SHIB_PERSON_SURNAME']
SHIB_ENTITLEMENT = ['HTTP_SHIB_EP_ENTITLEMENT']

225 226 227 228 229 230 231 232 233
TINYMCE_JS_URL = '/static/js/tinymce/tiny_mce.js'

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