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
|
CATEGORIES_PER_PAGE = 15
|
118
|
|
119
|
RSS_TITLE = 'Announces'
|
120
|
RSS_DESCRIPTION = ''
|
121
|
RSS_LINK = ''
|
122
|
RSS_LINK_TEMPLATE = '/#announce{0}'
|
123
|
RSS_ITEMS_LIMIT = 15
|
124
|
|
125
|
# Authentication settings
|
126
|
try:
|
127
|
import mellon
|
128
|
except ImportError:
|
129
|
mellon = None
|
130
|
|
131
|
if mellon is not None:
|
132
|
AUTHENTICATION_BACKENDS = (
|
133
|
'mellon.backends.SAMLBackend',
|
134
|
'django.contrib.auth.backends.ModelBackend',
|
135
|
)
|
136
|
|
137
|
LOGIN_URL = '/login/'
|
138
|
LOGIN_REDIRECT_URL = '/'
|
139
|
LOGOUT_URL = '/logout/'
|
140
|
|
141
|
MELLON_ATTRIBUTE_MAPPING = {
|
142
|
'email': '{attributes[email][0]}',
|
143
|
'first_name': '{attributes[first_name][0]}',
|
144
|
'last_name': '{attributes[last_name][0]}',
|
145
|
}
|
146
|
|
147
|
MELLON_SUPERUSER_MAPPING = {
|
148
|
'is_superuser': 'true',
|
149
|
}
|
150
|
|
151
|
MELLON_USERNAME_TEMPLATE = '{attributes[name_id_content]}'
|
152
|
|
153
|
MELLON_IDENTITY_PROVIDERS = []
|
154
|
|
155
|
if 'REST_FRAMEWORK' not in globals():
|
156
|
REST_FRAMEWORK = {}
|
157
|
|
158
|
REST_FRAMEWORK['DEFAULT_PERMISSION_CLASSES'] = (
|
159
|
'rest_framework.permissions.IsAuthenticated',
|
160
|
)
|
161
|
|
162
|
# default site
|
163
|
SITE_BASE_URL = 'http://localhost'
|
164
|
|
165
|
# default SMS Gateway
|
166
|
SMS_GATEWAY_URL = None
|
167
|
|
168
|
# sms expeditor
|
169
|
SMS_EXPEDITOR = 'Corbo'
|
170
|
|
171
|
# proxies argument passed to all python-request methods
|
172
|
# (see http://docs.python-requests.org/en/master/user/advanced/#proxies)
|
173
|
REQUESTS_PROXIES = None
|
174
|
|
175
|
|
176
|
local_settings_file = os.environ.get('CORBO_SETTINGS_FILE',
|
177
|
os.path.join(os.path.dirname(__file__), 'local_settings.py'))
|
178
|
if os.path.exists(local_settings_file):
|
179
|
execfile(local_settings_file)
|