settings.py.dist 8.74 KB
Newer Older
Leonidas Poulopoulos's avatar
Leonidas Poulopoulos committed
1
# Django settings for eduroam project.
2
import os
Leonidas Poulopoulos's avatar
Leonidas Poulopoulos committed
3
4
5

DEBUG = True
TEMPLATE_DEBUG = DEBUG
6
here = lambda x: os.path.join(os.path.abspath(os.path.dirname(__file__)), x)
Leonidas Poulopoulos's avatar
Leonidas Poulopoulos committed
7
8

ADMINS = (
9
     ('Admin', 'admin@example.com'),
Leonidas Poulopoulos's avatar
Leonidas Poulopoulos committed
10
11
12
13
14
15
16
17
18
19
20
21
)

MANAGERS = ADMINS

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
        'NAME': '',                      # Or path to database file if using sqlite3.
        '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.
22
        'STORAGE_ENGINE': 'INNODB',        
Leonidas Poulopoulos's avatar
Leonidas Poulopoulos committed
23
24
25
26
27
28
29
30
31
32
    }
}

# 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.
33
34
TIME_ZONE = 'Europe/Athens'

35

36
37
38
39
40
41
_ = lambda s: s

LANGUAGES = (
    ('el', _('Greek')),
    ('en', _('English')),
)
Leonidas Poulopoulos's avatar
Leonidas Poulopoulos committed
42
43
44

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
45
LANGUAGE_CODE = 'en'
Leonidas Poulopoulos's avatar
Leonidas Poulopoulos committed
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65

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 = ''

66
STATIC_URL = '/example/static'
67

Leonidas Poulopoulos's avatar
Leonidas Poulopoulos committed
68
69
70
71
72
73
74
75
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
ADMIN_MEDIA_PREFIX = '/media/'

# Make this unique, and don't share it with anybody.
SECRET_KEY = 'x)gmuyo2h=l@tmpyh4b(-!gki%@u$-=3^@z+vf&&!ci7$*!+k9'

76
77

AUTHENTICATION_BACKENDS = (
78
79
80
    'eduroam.djangobackends.shibauthBackend.shibauthBackend',    
    'eduroam.djangobackends.ldapBackend.ldapBackend',    
    'social_auth.backends.twitter.TwitterBackend',
81
    #'social_auth.backends.facebook.FacebookBackend',
82
    'social_auth.backends.google.GoogleBackend',
83
84
85
    #'social_auth.backends.contrib.linkedin.LinkedinBackend',
    #'social_auth.backends.contrib.yahoo.YahooOAuthBackend',
    #'social_auth.backends.yahoo.YahooBackend',
86
87
    'social_auth.backends.OpenIDBackend',
	'django.contrib.auth.backends.ModelBackend',
88
89
90
)


Leonidas Poulopoulos's avatar
Leonidas Poulopoulos committed
91
92
93
94
95
96
97
# 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',
)

98
99
100
101
102
103
104
105
TEMPLATE_CONTEXT_PROCESSORS = (
    # Required so that RequestContext is passed into
    # template
    'django.core.context_processors.auth',
    'django.core.context_processors.debug',
    'django.core.context_processors.i18n',
    'django.core.context_processors.media',
    'django.core.context_processors.request',
106
    'edumanage.context_processors.country_code',
107
    'social_auth.context_processors.social_auth_by_type_backends',
108
109
)

Leonidas Poulopoulos's avatar
Leonidas Poulopoulos committed
110
MIDDLEWARE_CLASSES = (
111
112
    'django.middleware.cache.UpdateCacheMiddleware',
    'django.middleware.gzip.GZipMiddleware',
Leonidas Poulopoulos's avatar
Leonidas Poulopoulos committed
113
114
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
115
    'django.middleware.locale.LocaleMiddleware',
Leonidas Poulopoulos's avatar
Leonidas Poulopoulos committed
116
117
118
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
119
    'django.middleware.cache.FetchFromCacheMiddleware',
120
    'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
121
    'edumanage.middleware.WrongBackendExceptionMiddleware',
Leonidas Poulopoulos's avatar
Leonidas Poulopoulos committed
122
123
124
125
126
)

ROOT_URLCONF = 'eduroam.urls'

TEMPLATE_DIRS = (
127
    "/example/templates"
Leonidas Poulopoulos's avatar
Leonidas Poulopoulos committed
128
129
130
131
132
133
    # 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 = (
134
    'longerusername',
Leonidas Poulopoulos's avatar
Leonidas Poulopoulos committed
135
136
137
138
139
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
140
141
142
143
    'django.contrib.flatpages',
    'django.contrib.markup',
    'django.contrib.admin',
    'django.contrib.admindocs',
144
    'edumanage',
145
146
    'accounts',
    'south',
147
    'registration',
148
    'django_extensions',
149
    'tinymce',
150
    'social_auth',
151
    
Leonidas Poulopoulos's avatar
Leonidas Poulopoulos committed
152
)
153
154
155

AUTH_PROFILE_MODULE = 'accounts.UserProfile'

156
157
LOGIN_URL = '/login/'

158
KML_FILE = here('all.kml')
159
INST_XML_FILE = here('institution.xml')
160

161
EDUROAM_KML_URL = 'http://monitor.eduroam.org/kml/all.kml'
162

163
164
SHIB_AUTH_ENTITLEMENT = 'urn:mace:example.com:pki:user'
SHIB_LOGOUT_URL = 'https://example.com/Shibboleth.sso/Logout'
165

166
SERVER_EMAIL = "Example domain eduroam Service <noreply@example.com>"
167
168
169
170
171
172
173
174
175
176
177
178
179
EMAIL_SUBJECT_PREFIX = "[eduroam] "
ACCOUNT_ACTIVATION_DAYS = 7
NOTIFY_ADMIN_MAILS = ["mail1@example.com", "mail2@example.com"]


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",
}

180
CACHE_BACKEND = 'memcached://127.0.0.1:11211/?timeout=5184000'
181

182
# Frontend country specific vars, eg. Greece
183
NRO_COUNTRY_NAME = _('My Country')
184
# Variable used by context_processor to display the "eduroam | <country_code>" in base.html 
185
NRO_COUNTRY_CODE = 'gr'
186
# main domain url used in right top icon, eg. http://www.grnet.gr
187
188
189
190
191
192
193
194
NRO_DOMAIN_MAIN_URL = "http://www.example.com"
# developer info for footer
NRO_DEV_BY_DICT = {"name": "EXAMPLE DEV TEAM", "url": "http://devteam.example.com"}
#NRO social media contact (Use: // to preserve https)
NRO_DEV_SOCIAL_MEDIA_CONTACT = [
                                {"url":"//soc.media.url", "icon":"icon.png", "name":"NAME1(eg. Facebook)"}, 
                                {"url":"//soc.media.url", "icon":"icon.png",  "name":"NAME2(eg. Twitter)"},
                                ]
195
196
197
# map center (lat, lng)
MAP_CENTER = (36.97, 23.71)
#Helpdesk, used in base.html: 
198
NRO_DOMAIN_HELPDESK_DICT = {"name": _("Domain Helpdesk"), 'email':'helpdesk@example.com', 'phone': '12324567890', 'uri': 'helpdesk.example.com'}
199

200
201
202
203
204
205
206
207
208
# Overview LDAP
LDAP_AUTH_SETTINGS = (
    {'url': 'ldap://ds.example.com',   'base': 'dc=dept,dc=example,dc=com'},
)
# If defined as a string new users will belong in this group. Group must exist
LDAP_AUTH_GROUP = None
# Whether new users will have admin access
LDAP_AUTH_IS_STAFF = False

209
210
211
212
213
214
#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']
215

216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
# DJANGO SOCIAL AUTH PLUGIN SETTINGS

TWITTER_CONSUMER_KEY = ''
TWITTER_CONSUMER_SECRET = ''

FACEBOOK_APP_ID = ''
FACEBOOK_API_SECRET = ''

LINKEDIN_CONSUMER_KEY        = ''
LINKEDIN_CONSUMER_SECRET     = ''

LINKEDIN_SCOPE = ['r_basicprofile', 'r_emailaddress']
LINKEDIN_EXTRA_FIELD_SELECTORS = ['email-address', 'headline', 'industry']
LINKEDIN_EXTRA_DATA = [('id', 'id'),
                       ('first-name', 'first_name'),
                       ('last-name', 'last_name'),
                       ('email-address', 'email_address'),
                       ('headline', 'headline'),
                       ('industry', 'industry')]

YAHOO_CONSUMER_KEY = ''
YAHOO_CONSUMER_SECRET = ''

GOOGLE_SREG_EXTRA_DATA = []

SOCIAL_AUTH_FORCE_POST_DISCONNECT = True

FACEBOOK_EXTENDED_PERMISSIONS = ['email']

245
246
247
SOCIAL_AUTH_LOGIN_REDIRECT_URL = '/manage/'
LOGIN_REDIRECT_URL = '/manage/'
SOCIAL_AUTH_INACTIVE_USER_URL = '/manage/'
248
249

SOCIAL_AUTH_FORCE_POST_DISCONNECT = True
250
SOCIAL_AUTH_REDIRECT_IS_HTTPS = True
251
252
253
SOCIAL_AUTH_CREATE_USERS = True
SOCIAL_AUTH_FORCE_RANDOM_USERNAME = False
SOCIAL_AUTH_SANITIZE_REDIRECTS = False
254
255
256
257
258
259
260
261
262
263
264
265
266



SOCIAL_AUTH_PIPELINE = (
    'social_auth.backends.pipeline.social.social_auth_user',
    'social_auth.backends.pipeline.user.get_username',
    'social_auth.backends.pipeline.user.create_user',
    'social_auth.backends.pipeline.social.associate_user',
    'social_auth.backends.pipeline.social.load_extra_data',
    'social_auth.backends.pipeline.user.update_user_details',
)