-
Notifications
You must be signed in to change notification settings - Fork 3
/
settings.py
executable file
·304 lines (246 loc) · 9.67 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
#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
# encoding=utf-8
import os
# -------------------------------------------------------------------- #
# MAIN CONFIGURATION #
# -------------------------------------------------------------------- #
# you should configure your database here before doing any real work.
# see: http://docs.djangoproject.com/en/dev/ref/settings/#databases
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": "haruka.db",
}
}
# debug mode is turned on as default, since rapidsms is under heavy
# development at the moment, and full stack traces are very useful
# when reporting bugs. don't forget to turn this off in production.
DEBUG = TEMPLATE_DEBUG = True
# the rapidsms backend configuration is designed to resemble django's
# database configuration, as a nested dict of (name, configuration).
#
# the ENGINE option specifies the module of the backend; the most common
# backend types (for a GSM modem or an SMPP server) are bundled with
# rapidsms, but you may choose to write your own.
#
# all other options are passed to the Backend when it is instantiated,
# to configure it. see the documentation in those modules for a list of
# the valid options for each.
INSTALLED_BACKENDS = {
# "TLS-TT-Bluetooth": {
# "ENGINE": "rapidsms.backends.gsm",
# "PORT": "/dev/tty.Nokia6230-COM1",
# 'PORT' : "/dev/tty.usbmodem641",
# "baudrate": 115200,
# "rtscts": 1,
# },
# "TLS-TT": {
# "ENGINE": "rapidsms.backends.gsm",
# #"PORT": "/dev/tty.MTCBA-U-G410",
# "PORT" : "/dev/tty.HUAWEIMobile-Modem",
# "baudrate": 115200,
# "rtscts": 1,
# },
"message_tester": {
"ENGINE": "rapidsms.backends.bucket",
}
}
# Internationalisation and Localisation
USE_I18N = True
USE_L10N = True
LANGUAGE_CODE = 'tet'
COUNTRY_CODE = 'TL'
LANGUAGES = (
('tet', 'Tetun'),
('en', 'English'),
)
SANITIZE_PHONENUMBERS = True
DEFAULT_BACKEND_NAME = "console"
# to help you get started quickly, many django/rapidsms apps are enabled
# by default. you may wish to remove some and/or add your own.
INSTALLED_APPS = [
"haruka_theme",
# the essentials.
"django_nose",
"djtables",
"rapidsms",
# common dependencies (which don't clutter up the ui).
"rapidsms.contrib.handlers",
# enable the django admin using a little shim app (which includes
# the required urlpatterns), and a bunch of undocumented apps that
# the AdminSite seems to explode without.
"django.contrib.sites",
"django.contrib.auth",
"django.contrib.admin",
"django.contrib.sessions",
"django.contrib.contenttypes",
"django.contrib.staticfiles",
# the rapidsms contrib apps.
"rapidsms.contrib.default",
"rapidsms.contrib.export",
"rapidsms.contrib.locations",
"rapidsms.contrib.messaging",
"rapidsms.contrib.scheduler",
"rapidsms.contrib.echo",
# Haruka specific #
###################
# 'rosetta',
"eav", # used by xforms
"uni_form", # used by xforms
"django_sorting", # used by groups
"pagination",
"rapidsms_xforms",
"registration",
"contact",
'groups',
"bulksend",
# for the polls
"mptt",
"code_generator",
"rapidsms.contrib.locations.nested",
"simple_locations",
"rapidsms_httprouter",
"poll",
"rosetta",
]
if DEBUG == True:
INSTALLED_APPS += [
"django_extensions",
"werkzeug",
]
elif DEBUG == False:
INSTALLED_APPS += [
"django_wsgiserver"
]
# rapidsms-httprouter related items
SMS_APPS = [
"registration",
"rapidsms_xforms",
"bulksend",
"poll",
]
# pointing the rapidsms-httprouter to pygsm-gateway
ROUTER_URL = "http://localhost:8080/?backend=%(backend)s&identity=%(recipient)s&text=%(text)s"
ROUTER_ADDR = "http://localhost:8080/"
ROUTER_WORKERS = 1
# rapidsms-xforms specific settings
XFORMS_HOST = 'localhost:8000'
# this rapidsms-specific setting defines which views are linked by the
# tabbed navigation. when adding an app to INSTALLED_APPS, you may wish
# to add it here, also, to expose it in the rapidsms ui.
_ = lambda s: s
RAPIDSMS_TABS = [
# Haruka specific
('rapidsms-dashboard', _("Activity")),
("polls", _("Polls")),
("xforms", _("Data Collection")),
("bulksend", _("Messaging")),
('list-groups', _("Groups")),
("registration", _("Contacts")),
# ("httprouter-console", "Testing"), # for use with rapidsms_httprouter
# ("rapidsms.contrib.messagelog.views.message_log", "Message Log"), # can't be used with rapidsms_httprouter
# ("rapidsms.contrib.messaging.views.messaging", "Messaging"),
# ("rapidsms.contrib.locations.views.locations", "Map"),
# ("rapidsms.contrib.scheduler.views.index", "Event Scheduler"),
# ("rapidsms.contrib.httptester.views.generate_identity", "Message Tester"),
]
MIDDLEWARE_CLASSES = (
'django_sorting.middleware.SortingMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
# 'django.middleware.csrf.CsrfViewMiddleware',
# 'django.middleware.csrf.CsrfResponseMiddleware',
)
# -------------------------------------------------------------------- #
# BORING CONFIGURATION #
# -------------------------------------------------------------------- #
# after login (which is handled by django.contrib.auth), redirect to the
# dashboard rather than 'accounts/profile' (the default).
LOGIN_REDIRECT_URL = "/"
LOGIN_URL = "/account/login"
# use django-nose to run tests. rapidsms contains lots of packages and
# modules which django does not find automatically, and importing them
# all manually is tiresome and error-prone.
TEST_RUNNER = "django_nose.NoseTestSuiteRunner"
# for some reason this setting is blank in django's global_settings.py,
# but it is needed for static assets to be linkable.
MEDIA_URL = "/site-media/"
# this is required for the django.contrib.sites tests to run, but also
# not included in global_settings.py, and is almost always ``1``.
# see: http://docs.djangoproject.com/en/dev/ref/contrib/sites/
SITE_ID = 1
# the default log settings are very noisy.
LOG_LEVEL = "INFO" # was "DEBUG"
LOG_FILE = "logs/rapidsms.log"
LOG_FORMAT = "[%(name)s]: %(message)s"
LOG_SIZE = 8192 # 8192 bits = 8 kb
LOG_BACKUPS = 256 # number of logs to keep
# these weird dependencies should be handled by their respective apps,
# but they're not, so here they are. most of them are for django admin.
TEMPLATE_CONTEXT_PROCESSORS = [
"django.contrib.auth.context_processors.auth",
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.media",
"django.core.context_processors.request",
"django.core.context_processors.static",
]
# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = os.getcwd()+'/static/'
# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/static/'
# Additional locations of static files
STATICFILES_DIRS = (
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)
# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
#'django.template.loaders.eggs.Loader',
)
# -------------------------------------------------------------------- #
# HERE BE DRAGONS! #
# these settings are pure hackery, and will go away soon #
# -------------------------------------------------------------------- #
# these apps should not be started by rapidsms in your tests, however,
# the models and bootstrap will still be available through django.
TEST_EXCLUDED_APPS = [
"django.contrib.sessions",
"django.contrib.contenttypes",
"django.contrib.auth",
"rapidsms",
#"rapidsms.contrib.ajax", # can't be used with rapidsms_httprouter
#"rapidsms.contrib.httptester", # can't be used with rapidsms_httprouter
]
# the project-level url patterns
ROOT_URLCONF = "urls"
# since we might hit the database from any thread during testing, the
# in-memory sqlite database isn't sufficient. it spawns a separate
# virtual database for each thread, and syncdb is only called for the
# first. this leads to confusing "no such table" errors. We create
# a named temporary instance instead.
import os
import tempfile
import sys
if 'test' in sys.argv:
for db_name in DATABASES:
DATABASES[db_name]['TEST_NAME'] = os.path.join(
tempfile.gettempdir(),
"%s.rapidsms.test.sqlite3" % db_name)