Projet

Général

Profil

Télécharger (4,08 ko) Statistiques
| Branche: | Tag: | Révision:

mandayejs / mandayejs / settings.py @ c73a731a

1
# mandayejs - saml reverse proxy
2
# Copyright (C) 2015  Entr'ouvert
3
#
4
# This program is free software: you can redistribute it and/or modify it
5
# under the terms of the GNU Affero General Public License as published
6
# by the Free Software Foundation, either version 3 of the License, or
7
# (at your option) any later version.
8
#
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU Affero General Public License for more details.
13
#
14
# You should have received a copy of the GNU Affero General Public License
15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16

    
17
"""
18
Django settings for mandayejs project.
19

    
20
For more information on this file, see
21
https://docs.djangoproject.com/en/1.7/topics/settings/
22

    
23
For the full list of settings and their values, see
24
https://docs.djangoproject.com/en/1.7/ref/settings/
25
"""
26

    
27
from django.conf import global_settings
28

    
29
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
30
import os
31
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
32

    
33

    
34
# Quick-start development settings - unsuitable for production
35
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
36

    
37
# SECURITY WARNING: keep the secret key used in production secret!
38
SECRET_KEY = 'xlf$@r5j*6p5-l#q=bg&t$mlhf=v@fq9^xfs#%712zndtu2#2@'
39

    
40
# SECURITY WARNING: don't run with debug turned on in production!
41
DEBUG = True
42

    
43
TEMPLATE_DEBUG = True
44

    
45
ALLOWED_HOSTS = []
46

    
47

    
48
# Application definition
49

    
50
INSTALLED_APPS = (
51
    'django.contrib.admin',
52
    'django.contrib.auth',
53
    'django.contrib.contenttypes',
54
    'django.contrib.sessions',
55
    'django.contrib.messages',
56
    'django.contrib.staticfiles',
57
    'mandayejs.mandaye',
58
    'mandayejs.sites.vincennes',
59
    'gadjo',
60
    'mellon'
61
)
62

    
63
MIDDLEWARE_CLASSES = (
64
    'django.contrib.sessions.middleware.SessionMiddleware',
65
    'django.middleware.common.CommonMiddleware',
66
    'django.middleware.csrf.CsrfViewMiddleware',
67
    'django.contrib.auth.middleware.AuthenticationMiddleware',
68
    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
69
    'django.contrib.messages.middleware.MessageMiddleware',
70
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
71
    'django.middleware.locale.LocaleMiddleware',
72
)
73

    
74
ROOT_URLCONF = 'mandayejs.urls'
75

    
76
WSGI_APPLICATION = 'mandayejs.wsgi.application'
77

    
78

    
79
# Database
80
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases
81

    
82
DATABASES = {
83
    'default': {
84
        'ENGINE': 'django.db.backends.sqlite3',
85
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
86
    }
87
}
88

    
89
# Internationalization
90
# https://docs.djangoproject.com/en/1.7/topics/i18n/
91

    
92
LANGUAGE_CODE = 'fr'
93

    
94
TIME_ZONE = 'UTC'
95

    
96
USE_I18N = True
97

    
98
USE_L10N = True
99

    
100
USE_TZ = True
101

    
102
LANGUAGES = (
103
    ('fr', 'Francais'),
104
)
105

    
106
LOCALE_PATHS = (
107
    os.path.join(BASE_DIR, 'mandayejs/locale'),
108
)
109

    
110
# Static files (CSS, JavaScript, Images)
111
# https://docs.djangoproject.com/en/1.7/howto/static-files/
112
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
113

    
114
STATIC_URL = '/_mandaye/static/'
115

    
116
# Serve xstatic files, required for gadjo
117
STATICFILES_FINDERS = global_settings.STATICFILES_FINDERS + \
118
            ('gadjo.finders.XStaticFinder',)
119

    
120
STATIC_DIRS = (
121
    os.path.join(BASE_DIR, 'static'),
122
)
123

    
124
LOGIN_URL = 'mellon_login'
125
LOGIN_LOGOUT = 'mellon_logout'
126
LOGIN_REDIRECT_URL = 'post-login'
127

    
128
# Authentication settings
129
try:
130
    import mellon
131
except ImportError:
132
    mellon = None
133

    
134
if mellon is not None:
135
    AUTHENTICATION_BACKENDS = (
136
        'mellon.backends.SAMLBackend',
137
        'django.contrib.auth.backends.ModelBackend',
138
    )
139

    
140
MELLON_ATTRIBUTE_MAPPING = {
141
    'email': '{attributes[email][0]}',
142
    'first_name': '{attributes[first_name][0]}',
143
    'last_name': '{attributes[last_name][0]}',
144
}
145

    
146
MELLON_SUPERUSER_MAPPING = {
147
    'is_superuser': 'true'
148
}
149

    
150
MELLON_USERNAME_TEMPLATE = '{attributes[name_id_content]}'
151

    
152
MELLON_IDENDITY_PROVIDERS = []
153

    
154

    
155
local_settings_file = os.environ.get('MANDAYEJS_SETTINGS_FILE',
156
        os.path.join(os.path.dirname(__file__), 'local_settings.py'))
157
if os.path.exists(local_settings_file):
158
    execfile(local_settings_file)
(3-3/5)