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
|
ALLOWED_HOSTS = []
|
28
|
|
29
|
|
30
|
# Application definition
|
31
|
|
32
|
INSTALLED_APPS = (
|
33
|
'corbo',
|
34
|
'ckeditor',
|
35
|
'gadjo',
|
36
|
'django.contrib.auth',
|
37
|
'django.contrib.admin',
|
38
|
'django.contrib.contenttypes',
|
39
|
'django.contrib.sessions',
|
40
|
'django.contrib.messages',
|
41
|
'django.contrib.staticfiles',
|
42
|
'rest_framework',
|
43
|
)
|
44
|
|
45
|
MIDDLEWARE_CLASSES = (
|
46
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
47
|
'django.middleware.common.CommonMiddleware',
|
48
|
'django.middleware.csrf.CsrfViewMiddleware',
|
49
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
50
|
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
|
51
|
'django.contrib.messages.middleware.MessageMiddleware',
|
52
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
53
|
)
|
54
|
|
55
|
ROOT_URLCONF = 'corbo.urls'
|
56
|
|
57
|
WSGI_APPLICATION = 'corbo.wsgi.application'
|
58
|
|
59
|
|
60
|
# Database
|
61
|
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases
|
62
|
|
63
|
DATABASES = {
|
64
|
'default': {
|
65
|
'ENGINE': 'django.db.backends.sqlite3',
|
66
|
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
67
|
}
|
68
|
}
|
69
|
|
70
|
# Internationalization
|
71
|
# https://docs.djangoproject.com/en/1.7/topics/i18n/
|
72
|
|
73
|
LANGUAGE_CODE = 'en-us'
|
74
|
|
75
|
TIME_ZONE = 'UTC'
|
76
|
|
77
|
USE_I18N = True
|
78
|
|
79
|
USE_L10N = True
|
80
|
|
81
|
USE_TZ = True
|
82
|
|
83
|
STATICFILES_FINDERS = global_settings.STATICFILES_FINDERS + ('gadjo.finders.XStaticFinder',)
|
84
|
|
85
|
# Templates
|
86
|
TEMPLATES = [
|
87
|
{
|
88
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
89
|
'DIRS': [
|
90
|
],
|
91
|
'APP_DIRS': True,
|
92
|
'OPTIONS': {
|
93
|
'context_processors': [
|
94
|
'django.contrib.auth.context_processors.auth',
|
95
|
'django.template.context_processors.debug',
|
96
|
'django.template.context_processors.i18n',
|
97
|
'django.template.context_processors.media',
|
98
|
'django.template.context_processors.request',
|
99
|
'django.template.context_processors.static',
|
100
|
'django.template.context_processors.tz',
|
101
|
'django.contrib.messages.context_processors.messages',
|
102
|
],
|
103
|
},
|
104
|
},
|
105
|
]
|
106
|
|
107
|
# Static files (CSS, JavaScript, Images)
|
108
|
# https://docs.djangoproject.com/en/1.7/howto/static-files/
|
109
|
|
110
|
STATIC_URL = '/static/'
|
111
|
|
112
|
STATIC_ROOT = 'static'
|
113
|
|
114
|
CKEDITOR_UPLOAD_PATH = 'ckeditor/uploads'
|
115
|
CKEDITOR_IMAGE_BACKEND = 'pillow'
|
116
|
CKEDITOR_CONFIGS = {
|
117
|
'default': {
|
118
|
'allowedContent': True,
|
119
|
'removePlugins': 'stylesheetparser',
|
120
|
'toolbar_Own': [['Source', 'Format', '-', 'Bold', 'Italic'],
|
121
|
['NumberedList', 'BulletedList'],
|
122
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
123
|
['Link', 'Unlink'],
|
124
|
['Image',],
|
125
|
['RemoveFormat',],
|
126
|
['Maximize']],
|
127
|
'toolbar': 'Own',
|
128
|
'resize_enabled': False,
|
129
|
},
|
130
|
}
|
131
|
|
132
|
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
|
133
|
MEDIA_URL = '/media/'
|
134
|
|
135
|
ANNOUNCES_PER_PAGE = 20
|
136
|
CATEGORIES_PER_PAGE = 15
|
137
|
|
138
|
RSS_TITLE = 'Announces'
|
139
|
RSS_DESCRIPTION = ''
|
140
|
RSS_LINK = ''
|
141
|
RSS_LINK_TEMPLATE = '/#announce{0}'
|
142
|
RSS_ITEMS_LIMIT = 15
|
143
|
|
144
|
# Authentication settings
|
145
|
try:
|
146
|
import mellon
|
147
|
except ImportError:
|
148
|
mellon = None
|
149
|
|
150
|
if mellon is not None:
|
151
|
AUTHENTICATION_BACKENDS = (
|
152
|
'mellon.backends.SAMLBackend',
|
153
|
'django.contrib.auth.backends.ModelBackend',
|
154
|
)
|
155
|
|
156
|
LOGIN_URL = '/login/'
|
157
|
LOGIN_REDIRECT_URL = '/'
|
158
|
LOGOUT_URL = '/logout/'
|
159
|
|
160
|
MELLON_ATTRIBUTE_MAPPING = {
|
161
|
'email': '{attributes[email][0]}',
|
162
|
'first_name': '{attributes[first_name][0]}',
|
163
|
'last_name': '{attributes[last_name][0]}',
|
164
|
}
|
165
|
|
166
|
MELLON_SUPERUSER_MAPPING = {
|
167
|
'is_superuser': 'true',
|
168
|
}
|
169
|
|
170
|
MELLON_USERNAME_TEMPLATE = '{attributes[name_id_content]}'
|
171
|
|
172
|
MELLON_IDENTITY_PROVIDERS = []
|
173
|
|
174
|
if 'REST_FRAMEWORK' not in globals():
|
175
|
REST_FRAMEWORK = {}
|
176
|
|
177
|
REST_FRAMEWORK['DEFAULT_PERMISSION_CLASSES'] = (
|
178
|
'rest_framework.permissions.IsAuthenticated',
|
179
|
)
|
180
|
|
181
|
# default site
|
182
|
SITE_BASE_URL = 'http://localhost'
|
183
|
|
184
|
# default SMS Gateway
|
185
|
SMS_GATEWAY_URL = None
|
186
|
|
187
|
# sms expeditor
|
188
|
SMS_EXPEDITOR = 'Corbo'
|
189
|
|
190
|
# proxies argument passed to all python-request methods
|
191
|
# (see http://docs.python-requests.org/en/master/user/advanced/#proxies)
|
192
|
REQUESTS_PROXIES = None
|
193
|
|
194
|
|
195
|
local_settings_file = os.environ.get('CORBO_SETTINGS_FILE',
|
196
|
os.path.join(os.path.dirname(__file__), 'local_settings.py'))
|
197
|
if os.path.exists(local_settings_file):
|
198
|
execfile(local_settings_file)
|