Statistics
| Branch: | Tag: | Revision:

root / settings.py.dist @ 0475f7fa

History | View | Annotate | Download (10 kB)

1
# Django settings for djnro 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) and
7
#Zenon Mousmoulas (zmousm-at-noc-dot-grnet-dot-gr), 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
import os
23

    
24
DEBUG = False
25
TEMPLATE_DEBUG = DEBUG
26
here = lambda x: os.path.join(os.path.abspath(os.path.dirname(__file__)), x)
27

    
28
ADMINS = (
29
     ('Admin', 'admin@example.com'),
30
)
31

    
32
MANAGERS = ADMINS
33

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

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

    
55

    
56
_ = lambda s: s
57

    
58
LANGUAGES = (
59
    ('el', _('Greek')),
60
    ('en', _('English')),
61
)
62

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

    
67
SITE_ID = 1
68

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

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

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

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

    
86
STATIC_URL = '/example/static'
87

    
88
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
89
# trailing slash.
90
# Examples: "http://foo.com/media/", "/media/".
91
ADMIN_MEDIA_PREFIX = '/media/'
92

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

    
96

    
97
AUTHENTICATION_BACKENDS = (
98
    'djnro.djangobackends.shibauthBackend.shibauthBackend',    
99
    'djnro.djangobackends.ldapBackend.ldapBackend',    
100
    'social_auth.backends.twitter.TwitterBackend',
101
    #'social_auth.backends.facebook.FacebookBackend',
102
    'social_auth.backends.google.GoogleBackend',
103
    #'social_auth.backends.contrib.linkedin.LinkedinBackend',
104
    #'social_auth.backends.contrib.yahoo.YahooOAuthBackend',
105
    #'social_auth.backends.yahoo.YahooBackend',
106
    'social_auth.backends.OpenIDBackend',
107
	'django.contrib.auth.backends.ModelBackend',
108
)
109

    
110

    
111
# List of callables that know how to import templates from various sources.
112
TEMPLATE_LOADERS = (
113
    'django.template.loaders.filesystem.Loader',
114
    'django.template.loaders.app_directories.Loader',
115
#     'django.template.loaders.eggs.Loader',
116
)
117

    
118
TEMPLATE_CONTEXT_PROCESSORS = (
119
    # Required so that RequestContext is passed into
120
    # template
121
    'django.core.context_processors.auth',
122
    'django.core.context_processors.debug',
123
    'django.core.context_processors.i18n',
124
    'django.core.context_processors.media',
125
    'django.core.context_processors.request',
126
    'edumanage.context_processors.country_code',
127
    'social_auth.context_processors.social_auth_by_type_backends',
128
)
129

    
130
MIDDLEWARE_CLASSES = (
131
    'django.middleware.cache.UpdateCacheMiddleware',
132
    'django.middleware.gzip.GZipMiddleware',
133
    'django.middleware.common.CommonMiddleware',
134
    'django.contrib.sessions.middleware.SessionMiddleware',
135
    'django.middleware.locale.LocaleMiddleware',
136
    'django.middleware.csrf.CsrfViewMiddleware',
137
    'django.contrib.auth.middleware.AuthenticationMiddleware',
138
    'django.contrib.messages.middleware.MessageMiddleware',
139
    'django.middleware.cache.FetchFromCacheMiddleware',
140
    'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
141
    'edumanage.middleware.WrongBackendExceptionMiddleware',
142
)
143

    
144
ROOT_URLCONF = 'djnro.urls'
145

    
146
TEMPLATE_DIRS = (
147
    "/example/templates"
148
    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
149
    # Always use forward slashes, even on Windows.
150
    # Don't forget to use absolute paths, not relative paths.
151
)
152

    
153
INSTALLED_APPS = (
154
    'longerusername',
155
    'django.contrib.auth',
156
    'django.contrib.contenttypes',
157
    'django.contrib.sessions',
158
    'django.contrib.sites',
159
    'django.contrib.messages',
160
    'django.contrib.flatpages',
161
    'django.contrib.markup',
162
    'django.contrib.admin',
163
    'django.contrib.admindocs',
164
    'edumanage',
165
    'accounts',
166
    'south',
167
    'registration',
168
    'django_extensions',
169
    'tinymce',
170
    'social_auth',
171
    
172
)
173

    
174
AUTH_PROFILE_MODULE = 'accounts.UserProfile'
175

    
176
LOGIN_URL = '/manage/login/'
177

    
178
KML_FILE = here('all.kml')
179
INST_XML_FILE = here('institution.xml')
180

    
181
EDUROAM_KML_URL = 'http://monitor.eduroam.org/kml/all.kml'
182

    
183
SHIB_AUTH_ENTITLEMENT = 'urn:mace:example.com:pki:user'
184
SHIB_LOGOUT_URL = 'https://example.com/Shibboleth.sso/Logout'
185

    
186
SERVER_EMAIL = "Example domain eduroam Service <noreply@example.com>"
187
EMAIL_SUBJECT_PREFIX = "[eduroam] "
188
ACCOUNT_ACTIVATION_DAYS = 7
189
NOTIFY_ADMIN_MAILS = ["mail1@example.com", "mail2@example.com"]
190

    
191

    
192
TINYMCE_JS_URL = '/static/js/tinymce/tiny_mce.js'
193

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

    
200
CACHE_BACKEND = 'memcached://127.0.0.1:11211/?timeout=5184000'
201

    
202
#Name_i18n, URL_i18n, language choice field
203
# If it's the same with LANGUAGES, simply do URL_NAME_LANGS = LANGUAGES
204
URL_NAME_LANGS = (
205
        ('en', 'English' ),
206
        ('el', 'Ελληνικά'),
207
    )
208

    
209
# Frontend country specific vars, eg. Greece
210
NRO_COUNTRY_NAME = _('My Country')
211
# Variable used by context_processor to display the "eduroam | <country_code>" in base.html 
212
NRO_COUNTRY_CODE = 'gr'
213
# main domain url used in right top icon, eg. http://www.grnet.gr
214
NRO_DOMAIN_MAIN_URL = "http://www.example.com"
215
# developer info for footer
216
NRO_DEV_BY_DICT = {"name": "EXAMPLE DEV TEAM", "url": "http://devteam.example.com"}
217
#NRO social media contact (Use: // to preserve https)
218
NRO_DEV_SOCIAL_MEDIA_CONTACT = [
219
                                {"url":"//soc.media.url", "icon":"icon.png", "name":"NAME1(eg. Facebook)"}, 
220
                                {"url":"//soc.media.url", "icon":"icon.png",  "name":"NAME2(eg. Twitter)"},
221
                                ]
222
# map center (lat, lng)
223
MAP_CENTER = (36.97, 23.71)
224
#Helpdesk, used in base.html: 
225
NRO_DOMAIN_HELPDESK_DICT = {"name": _("Domain Helpdesk"), 'email':'helpdesk@example.com', 'phone': '12324567890', 'uri': 'helpdesk.example.com'}
226

    
227
#Countries for Realm model:
228
REALM_COUNTRIES = (
229
             ('country_2letters', 'Country' ),
230
            )
231

    
232
# Overview LDAP
233
LDAP_AUTH_SETTINGS = (
234
    {'url': 'ldap://ds.example.com',   'base': 'dc=dept,dc=example,dc=com'},
235
)
236
# If defined as a string new users will belong in this group. Group must exist
237
LDAP_AUTH_GROUP = None
238
# Whether new users will have admin access
239
LDAP_AUTH_IS_STAFF = False
240

    
241
#Shibboleth attribute map
242
SHIB_USERNAME = ['HTTP_EPPN']
243
SHIB_MAIL = ['mail', 'HTTP_MAIL', 'HTTP_SHIB_INETORGPERSON_MAIL']
244
SHIB_FIRSTNAME = ['HTTP_SHIB_INETORGPERSON_GIVENNAME']
245
SHIB_LASTNAME = ['HTTP_SHIB_PERSON_SURNAME']
246
SHIB_ENTITLEMENT = ['HTTP_SHIB_EP_ENTITLEMENT']
247

    
248
# DJANGO SOCIAL AUTH PLUGIN SETTINGS
249

    
250
TWITTER_CONSUMER_KEY = ''
251
TWITTER_CONSUMER_SECRET = ''
252

    
253
FACEBOOK_APP_ID = ''
254
FACEBOOK_API_SECRET = ''
255

    
256
LINKEDIN_CONSUMER_KEY        = ''
257
LINKEDIN_CONSUMER_SECRET     = ''
258

    
259
LINKEDIN_SCOPE = ['r_basicprofile', 'r_emailaddress']
260
LINKEDIN_EXTRA_FIELD_SELECTORS = ['email-address', 'headline', 'industry']
261
LINKEDIN_EXTRA_DATA = [('id', 'id'),
262
                       ('first-name', 'first_name'),
263
                       ('last-name', 'last_name'),
264
                       ('email-address', 'email_address'),
265
                       ('headline', 'headline'),
266
                       ('industry', 'industry')]
267

    
268
YAHOO_CONSUMER_KEY = ''
269
YAHOO_CONSUMER_SECRET = ''
270

    
271
GOOGLE_SREG_EXTRA_DATA = []
272

    
273
SOCIAL_AUTH_FORCE_POST_DISCONNECT = True
274

    
275
FACEBOOK_EXTENDED_PERMISSIONS = ['email']
276

    
277
SOCIAL_AUTH_LOGIN_REDIRECT_URL = '/manage/'
278
LOGIN_REDIRECT_URL = '/manage/'
279
SOCIAL_AUTH_INACTIVE_USER_URL = '/manage/'
280

    
281
SOCIAL_AUTH_FORCE_POST_DISCONNECT = True
282
SOCIAL_AUTH_REDIRECT_IS_HTTPS = True
283
SOCIAL_AUTH_CREATE_USERS = True
284
SOCIAL_AUTH_FORCE_RANDOM_USERNAME = False
285
SOCIAL_AUTH_SANITIZE_REDIRECTS = False
286

    
287

    
288

    
289
SOCIAL_AUTH_PIPELINE = (
290
    'social_auth.backends.pipeline.social.social_auth_user',
291
    'social_auth.backends.pipeline.user.get_username',
292
    'social_auth.backends.pipeline.user.create_user',
293
    'social_auth.backends.pipeline.social.associate_user',
294
    'social_auth.backends.pipeline.social.load_extra_data',
295
    'social_auth.backends.pipeline.user.update_user_details',
296
)
297

    
298