This repository has been archived by the owner on May 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
/
settings.py
186 lines (163 loc) · 5.6 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
#!/usr/bin/bash
"""
Django settings file for local development purposes
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
import sys
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
DEBUG=True
TEST_MODE=True
TEST_ROOT = "tests"
TRANSACTIONS_MANAGED = {}
USE_TZ = True
TIME_ZONE = 'UTC'
SECRET_KEY='SHHHHHH'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': f'{TEST_ROOT}/db/notifications.db'
},
}
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'rest_framework',
'edx_notifications',
'edx_notifications.server.web',
)
REST_FRAMEWORK = {
'DEFAULT_THROTTLE_CLASSES': (
'rest_framework.throttling.UserRateThrottle',
),
}
if not TEST_MODE:
# we don't want to throttle unit tests
REST_FRAMEWORK.update({
'DEFAULT_THROTTLE_RATES': {
'user': '10/sec',
}
})
js_info_dict = {
# 'packages': 'edx_notifications.server.web',
}
LANGUAGE_CODE = 'en'
LANGUAGES = (
('en', 'English '),
('ar', 'العربية'), # Arabic
('Ar-sa', 'Arabic'), # Arabic Saudi Arabia
('zh', '中文(简体)'),
('ES419', 'Latin Spanish'),
('es', 'Español'),
('ja', 'Japanese'),
('ko', '한국어 (대한민국)'), # Korean (Korea)
('de', 'German'),
('fr', 'french'),
('nl', 'Dutch '),
('pl', 'Polskie'),
('pt', 'Português')
)
LOCALE_PATHS = [
os.path.join(BASE_DIR, 'locale'),
os.path.join(BASE_DIR, 'static_cache/locale'),
]
MIDDLEWARE = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
)
ROOT_URLCONF = 'edx_notifications.server.urls'
WSGI_APPLICATION = 'edx_notifications.server.wsgi.application'
TEMPLATES = [{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ['edx_notifications/server/web/templates']
}]
NOTIFICATION_STORE_PROVIDER = {
"class": "edx_notifications.stores.sql.store_provider.SQLNotificationStoreProvider",
"options": {
}
}
SOUTH_MIGRATION_MODULES = {
'edx_notifications': 'edx_notifications.stores.sql.migrations',
}
# to prevent run-away queries from happening
NOTIFICATION_MAX_LIST_SIZE = 100
# a mapping table which is used by the MsgTypeToUrlLinkResolver
# to map a notification type to a statically defined URL path
NOTIFICATION_CLICK_LINK_URL_MAPS = {
# To serve as a test exampe this will convert
# msg type 'open-edx.edx_notifications.lib.tests.test_publisher'
# to /path/to/{param1}/url/{param2} with param subsitutations
# that are passed in with the message
'open-edx.edx_notifications.lib.tests.test_publisher': '/path/to/{param1}/url/{param2}',
'open-edx.edx_notifications.lib.tests.*': '/alternate/path/to/{param1}/url/{param2}',
'open-edx-edx_notifications.lib.*': '/third/way/to/get/to/{param1}/url/{param2}',
}
# list all known channel providers
NOTIFICATION_CHANNEL_PROVIDERS = {
'durable': {
'class': 'edx_notifications.channels.durable.BaseDurableNotificationChannel',
'options': {
# list out all link resolvers
'link_resolvers': {
# right now the only defined resolver is 'type_to_url', which
# attempts to look up the msg type (key) via
# matching on the value
'msg_type_to_url': {
'class': 'edx_notifications.channels.link_resolvers.MsgTypeToUrlLinkResolver',
'config': {
'_click_link': NOTIFICATION_CLICK_LINK_URL_MAPS,
}
}
}
}
},
'parse-push': {
'class': 'edx_notifications.channels.parse_push.ParsePushNotificationChannelProvider',
'options': {
'application_id': 'test_id',
'rest_api_key': 'test_rest_api_key',
}
},
'urban-airship': {
'class': 'edx_notifications.channels.urban_airship.UrbanAirshipNotificationChannelProvider',
'options': {}
},
'triggered-email': {
'class': 'edx_notifications.channels.triggered_email.TriggeredEmailChannelProvider',
'options': {
# list out all link resolvers
'link_resolvers': {
# right now the only defined resolver is 'type_to_url', which
# attempts to look up the msg type (key) via
# matching on the value
'msg_type_to_url': {
'class': 'edx_notifications.channels.link_resolvers.MsgTypeToUrlLinkResolver',
'config': {
'_click_link': NOTIFICATION_CLICK_LINK_URL_MAPS,
}
}
}
}
},
'null': {
'class': 'edx_notifications.channels.null.NullNotificationChannel',
'options': {}
}
}
# list all of the mappings of notification types to channel
NOTIFICATION_CHANNEL_PROVIDER_TYPE_MAPS = {
'*': 'durable', # default global mapping
}
# Constants to set how long (in days) old READ and UNREAD notifications can remain in the system before being purged.
NOTIFICATION_PURGE_READ_OLDER_THAN_DAYS = 30
NOTIFICATION_PURGE_UNREAD_OLDER_THAN_DAYS = 60
# digest email logos
NOTIFICATION_BRANDED_DEFAULT_LOGO = 'edx_notifications/img/edx-openedx-logo-tag.png'
# digest email css
NOTIFICATION_DIGEST_EMAIL_CSS = 'edx_notifications/css/email_digests.css'