Projet

Général

Profil

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

root / corbo / settings.py @ 02ed310e

1
"""
2
Django settings for corbo project.
3

    
4
For more information on this file, see
5
https://docs.djangoproject.com/en/1.7/topics/settings/
6

    
7
For the full list of settings and their values, see
8
https://docs.djangoproject.com/en/1.7/ref/settings/
9
"""
10

    
11
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
12
import os
13

    
14
from django.conf import global_settings
15

    
16
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
17

    
18
# Quick-start development settings - unsuitable for production
19
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
20

    
21
# SECURITY WARNING: keep the secret key used in production secret!
22
SECRET_KEY = '$%7m&rq1-&$c77a1s^_$=xgiqez-%_x3^&5=*^-4(6si2zu59z'
23

    
24
# SECURITY WARNING: don't run with debug turned on in production!
25
DEBUG = True
26

    
27
TEMPLATE_DEBUG = True
28

    
29
ALLOWED_HOSTS = []
30

    
31

    
32
# Application definition
33

    
34
INSTALLED_APPS = (
35
    'corbo',
36
    'ckeditor',
37
    'gadjo',
38
    'django.contrib.auth',
39
    'django.contrib.admin',
40
    'django.contrib.contenttypes',
41
    'django.contrib.sessions',
42
    'django.contrib.messages',
43
    'django.contrib.staticfiles',
44
    'rest_framework',
45
)
46

    
47
MIDDLEWARE_CLASSES = (
48
    'django.contrib.sessions.middleware.SessionMiddleware',
49
    'django.middleware.common.CommonMiddleware',
50
    'django.middleware.csrf.CsrfViewMiddleware',
51
    'django.contrib.auth.middleware.AuthenticationMiddleware',
52
    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
53
    'django.contrib.messages.middleware.MessageMiddleware',
54
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
55
)
56

    
57
ROOT_URLCONF = 'corbo.urls'
58

    
59
WSGI_APPLICATION = 'corbo.wsgi.application'
60

    
61

    
62
# Database
63
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases
64

    
65
DATABASES = {
66
    'default': {
67
        'ENGINE': 'django.db.backends.sqlite3',
68
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
69
    }
70
}
71

    
72
# Internationalization
73
# https://docs.djangoproject.com/en/1.7/topics/i18n/
74

    
75
LANGUAGE_CODE = 'en-us'
76

    
77
TIME_ZONE = 'UTC'
78

    
79
USE_I18N = True
80

    
81
USE_L10N = True
82

    
83
USE_TZ = True
84

    
85
STATICFILES_FINDERS = global_settings.STATICFILES_FINDERS + ('gadjo.finders.XStaticFinder',)
86

    
87

    
88
# Static files (CSS, JavaScript, Images)
89
# https://docs.djangoproject.com/en/1.7/howto/static-files/
90

    
91
STATIC_URL = '/static/'
92

    
93
STATIC_ROOT = 'static'
94

    
95
CKEDITOR_UPLOAD_PATH = 'ckeditor/uploads'
96
CKEDITOR_IMAGE_BACKEND = 'pillow'
97
CKEDITOR_CONFIGS = {
98
    'default': {
99
        'allowedContent': True,
100
        'removePlugins': 'stylesheetparser',
101
        'toolbar_Own': [['Source', 'Format', '-', 'Bold', 'Italic'],
102
                        ['NumberedList', 'BulletedList'],
103
                        ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
104
                        ['Link', 'Unlink'],
105
                        ['Image',],
106
                        ['RemoveFormat',],
107
                        ['Maximize']],
108
        'toolbar': 'Own',
109
        'resize_enabled': False,
110
    },
111
}
112

    
113
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
114
MEDIA_URL = '/media/'
115

    
116
ANNOUNCES_PER_PAGE = 20
117

    
118
RSS_TITLE = 'Announces'
119
RSS_DESCRIPTION = ''
120
RSS_LINK = ''
121
RSS_LINK_TEMPLATE = '/#announce{0}'
122

    
123
# Authentication settings
124
try:
125
    import mellon
126
except ImportError:
127
    mellon = None
128

    
129
if mellon is not None:
130
    AUTHENTICATION_BACKENDS = (
131
        'mellon.backends.SAMLBackend',
132
        'django.contrib.auth.backends.ModelBackend',
133
    )
134

    
135
LOGIN_URL = '/login/'
136
LOGIN_REDIRECT_URL = '/'
137
LOGOUT_URL = '/logout/'
138

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

    
145
MELLON_SUPERUSER_MAPPING = {
146
    'is_superuser': 'true',
147
}
148

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

    
151
MELLON_IDENTITY_PROVIDERS = []
152

    
153
if 'REST_FRAMEWORK' not in globals():
154
    REST_FRAMEWORK = {}
155

    
156
REST_FRAMEWORK['DEFAULT_PERMISSION_CLASSES'] = (
157
    'rest_framework.permissions.IsAuthenticated',
158
)
159

    
160
# default site
161
SITE_BASE_URL = 'http://localhost'
162

    
163
local_settings_file = os.environ.get('CORBO_SETTINGS_FILE',
164
        os.path.join(os.path.dirname(__file__), 'local_settings.py'))
165
if os.path.exists(local_settings_file):
166
    execfile(local_settings_file)
(7-7/11)