-
Notifications
You must be signed in to change notification settings - Fork 71
/
settings.py
364 lines (333 loc) · 9.54 KB
/
settings.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
"""
Django local settings for pod_project.
Django version: 3.2.
"""
import os
##
# flatpages
##
SITE_ID = 1
##
# The secret key for your particular Django installation.
#
# This is used to provide cryptographic signing,
# and should be set to a unique, unpredictable value.
#
# Django will not start if this is not set.
# https://docs.djangoproject.com/en/3.2/ref/settings/#secret-key
#
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = "A_CHANGER"
##
# Base folder
#
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
##
# DEBUG mode activation
#
# https://docs.djangoproject.com/en/3.2/ref/settings/#debug
#
# SECURITY WARNING: MUST be set to False when deploying into production.
DEBUG = True
##
# A list of strings representing the host/domain names
# that this Django site is allowed to serve.
#
# https://docs.djangoproject.com/en/3.2/ref/settings/#allowed-hosts
ALLOWED_HOSTS = ["localhost"]
##
# Session settings
#
# https://docs.djangoproject.com/en/3.2/ref/settings/#session-cookie-age
# https://docs.djangoproject.com/en/3.2/ref/settings/#session-expire-at-browser-close
#
SESSION_COOKIE_AGE = 14400
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
# SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTOCOL', 'https')
# SESSION_ENGINE = "django.contrib.sessions.backends.signed_cookies"
# SESSION_COOKIE_HTTPONLY = True
##
# A tuple that lists people who get code error notifications
# when DEBUG=False and a view raises an exception.
#
# https://docs.djangoproject.com/en/3.2/ref/settings/#std:setting-ADMINS
#
ADMINS = [("Name", "adminmail@univ.fr")]
##
# A tuple that lists people who get other notifications
# email from contact_us / end of encoding / report video
#
# https://docs.djangoproject.com/en/3.2/ref/settings/#std:setting-MANAGERS
MANAGERS = []
##
# A dictionary containing the settings for all databases
# to be used with Django.
#
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": os.path.join(BASE_DIR, "db.sqlite3"),
}
}
##
# Internationalization and localization.
#
# https://docs.djangoproject.com/en/3.2/topics/i18n/
# https://github.com/django/django/blob/master/django/conf/global_settings.py
LANGUAGE_CODE = "fr"
LANGUAGES = (("fr", "Français"), ("en", "English"))
##
# A string representing the time zone for this installation.
#
# https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
TIME_ZONE = "UTC"
##
# The directory to temporarily store data while uploading files.
#
# If None, the standard temporary directory for the operating system
# will be used.
#
# https://docs.djangoproject.com/en/3.2/ref/settings/#file-upload-temp-dir
#
FILE_UPLOAD_TEMP_DIR = os.path.join(os.path.sep, "var", "tmp")
# https://github.com/ouhouhsami/django-progressbarupload
FILE_UPLOAD_HANDLERS = (
"django.core.files.uploadhandler.MemoryFileUploadHandler",
"django.core.files.uploadhandler.TemporaryFileUploadHandler",
)
PROGRESSBARUPLOAD_INCLUDE_JQUERY = False
##
# Static files (assets, CSS, JavaScript, fonts...)
#
# https://docs.djangoproject.com/en/3.2/howto/static-files/
STATIC_URL = "/static/"
STATIC_ROOT = os.path.join(BASE_DIR, "static")
##
# Dynamic files (user managed content: videos, subtitles, documents, etc...)
#
# https://docs.djangoproject.com/en/3.2/ref/settings/#media-url
# https://docs.djangoproject.com/en/3.2/ref/settings/#media-root
#
# WARNING: this folder must have previously been created.
MEDIA_URL = "/media/"
MEDIA_ROOT = os.path.join(BASE_DIR, "media")
##
# CKeditor settings
#
# CKEDITOR_BASEPATH = os.path.join(STATIC_URL, 'ckeditor', "/")
CKEDITOR_UPLOAD_PATH = os.path.join(MEDIA_ROOT, "uploads")
CKEDITOR_CONFIGS = {
"complete": {"toolbar": "full", "height": 300, "width": "100%"},
"default": {
"height": 300,
"width": "100%",
"toolbar": "custom",
"language": "fr",
"toolbar_custom": [
{
"name": "basicstyles",
"items": [
"Bold",
"Italic",
"Underline",
"Strike",
"Subscript",
"Superscript",
"-",
"RemoveFormat",
],
},
{
"name": "paragraph",
"items": [
"NumberedList",
"BulletedList",
"-",
"Outdent",
"Indent",
"-",
"Blockquote",
"CreateDiv",
"-",
"JustifyLeft",
"JustifyCenter",
"JustifyRight",
"JustifyBlock",
"-",
"BidiLtr",
"BidiRtl",
],
},
{"name": "links", "items": ["Link", "Unlink", "Anchor"]},
{"name": "tools", "items": ["Maximize"]},
],
"removePlugins": "exportpdf",
},
}
##
# Video tiers apps settings
#
FORCE_LOWERCASE_TAGS = True
MAX_TAG_LENGTH = 50
##
# AUTH CAS
#
LOGIN_URL = "/authentication_login/"
##
# eMail settings
#
# https://docs.djangoproject.com/en/3.2/ref/settings/#email-host
# https://docs.djangoproject.com/en/3.2/ref/settings/#email-port
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-from-email
#
# username: EMAIL_HOST_USER
# password: EMAIL_HOST_PASSWORD
#
EMAIL_HOST = "smtp.univ.fr"
EMAIL_PORT = 25
DEFAULT_FROM_EMAIL = "noreply@univ.fr"
# https://docs.djangoproject.com/en/3.2/ref/settings/#std:setting-SERVER_EMAIL
SERVER_EMAIL = "noreply@univ.fr"
##
# Captcha config
#
CAPTCHA_CHALLENGE_FUNCT = "captcha.helpers.math_challenge"
# ('captcha.helpers.noise_arcs','captcha.helpers.noise_dots',)
CAPTCHA_NOISE_FUNCTIONS = (
"captcha.helpers.noise_arcs",
"captcha.helpers.noise_dots",
)
# ('captcha.helpers.noise_null',)
CAPTCHA_FONT_SIZE = 32
CAPTCHA_MATH_CHALLENGE_OPERATOR = "x"
##
# THIRD PARTY APPS OPTIONNAL
#
USE_PODFILE = False
THIRD_PARTY_APPS = []
##
# https://docs.djangoproject.com/en/3.2/ref/clickjacking/
# Add @xframe_options_exempt on a view you want to authorize in frame
#
X_FRAME_OPTIONS = "EXEMPT" # SAMEORIGIN OR DENY
###
# Enable LTI Provider
# https://github.com/ccnmtl/django-lti-provider
# if True
# LTI_ENABLED=False default
LTI_TOOL_CONFIGURATION = {
"title": "LTI Pod",
"description": "Pod description",
"launch_url": "lti/",
"embed_url": "",
"embed_icon_url": "",
"embed_tool_id": "",
"landing_url": "/",
"course_aware": False,
"course_navigation": True,
"new_tab": True,
"frame_width": 640,
"frame_height": 360,
"assignments": {
"addvideo": "/assignment/addvideo/",
"getvideo": "/assignment/getvideo/",
},
}
PYLTI_CONFIG = {"consumers": {"azerty": {"secret": "azerty"}}}
LTI_PROPERTY_LIST_EX = [
"custom_canvas_user_login_id",
"ext_user_username",
"context_title",
"lis_course_offering_sourcedid",
"custom_canvas_api_domain",
"custom_video",
]
LTI_PROPERTY_USER_USERNAME = "ext_user_username"
# SOLR Thumbnail use in video model to create thumbnail for video
# https://sorl-thumbnail.readthedocs.io/en/latest/reference/settings.html
THUMBNAIL_PRESERVE_FORMAT = True
SHOW_EVENTS_ON_HOMEPAGE = False
DEFAULT_EVENT_PATH = ""
DEFAULT_EVENT_THUMBNAIL = "/img/default-event.svg"
DEFAULT_EVENT_TYPE_ID = 1
"""
##
# Main menu settings:
#
# Do not show inactive users in “Owners” main menu list.
MENUBAR_HIDE_INACTIVE_OWNERS = True
# Show only staff users in “Owners” main menu list.
MENUBAR_SHOW_STAFF_OWNERS_ONLY = False
# Hide the language selector
HIDE_LANGUAGE_SELECTOR = False
# Hide Users tab in navbar
HIDE_USER_TAB = False
# Hide Channel tab in navbar
HIDE_CHANNEL_TAB = False
# Hide Types tab in navbar
HIDE_TYPES_TAB = False
# Hide Tags
HIDE_TAGS = False
# Hide share in social network
HIDE_SHARE = False
# Hide disciplines
HIDE_DISCIPLINES = False
# Hide types filter on sidebar
HIDE_TYPES = False
"""
VIDEO_RECENT_VIEWCOUNT = 180
HONEYPOT_FIELD_NAME = "firstname"
# PWA
PWA_APP_NAME = "Pod"
PWA_APP_DESCRIPTION = (
"Pod is aimed at users of our institutions, by allowing the publication of "
"videos in the fields of research (promotion of platforms, etc.), training "
"(tutorials, distance training, student reports, etc.), institutional life (video "
"of events), offering several days of content."
)
PWA_APP_THEME_COLOR = "#0A0302"
PWA_APP_BACKGROUND_COLOR = "#ffffff"
PWA_APP_DISPLAY = "standalone"
PWA_APP_SCOPE = "/"
PWA_APP_ORIENTATION = "any"
PWA_APP_START_URL = "/"
PWA_APP_STATUS_BAR_COLOR = "default"
PWA_APP_ICONS = [
{
"src": f"/static/img/icon_x{size}.png",
"sizes": f"{size}x{size}",
"purpose": "any maskable",
}
for size in (1024, 512, 384, 192, 128, 96, 72, 48)
]
PWA_APP_ICONS_APPLE = [
{
"src": f"/static/img/icon_x{size}.png",
"sizes": f"{size}x{size}",
}
for size in (1024, 512, 384, 192, 128, 96, 72, 48)
]
PWA_APP_SPLASH_SCREEN = [
{
"src": "/static/img/splash-512.png",
"media": (
"(device-width: 320px) "
"and (device-height: 568px) "
"and (-webkit-device-pixel-ratio: 2)"
),
}
]
PWA_APP_DIR = "ltr"
PWA_APP_LANG = "fr-FR"
PWA_APP_SCREENSHOTS = [
{"src": "/static/img/esup-pod.svg", "sizes": "750x1334", "type": "image/png"}
]
PWA_SERVICE_WORKER_PATH = os.path.join(
BASE_DIR,
"progressive_web_app",
"static",
"js",
"serviceworker.js",
)
PWA_APP_DEBUG_MODE = locals().get("DEBUG", False)