2011-07-16 06:11:20 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# vim: ai ts=4 sts=4 et sw=4
|
|
|
|
# encoding=utf-8
|
|
|
|
|
|
|
|
# -------------------------------------------------------------------- #
|
|
|
|
# MAIN CONFIGURATION #
|
|
|
|
# -------------------------------------------------------------------- #
|
2011-07-23 12:08:39 +00:00
|
|
|
import os
|
|
|
|
from os.path import join
|
2011-07-16 06:11:20 +00:00
|
|
|
|
2011-07-23 12:08:39 +00:00
|
|
|
PROJECT_PATH = os.path.dirname(__file__)
|
|
|
|
JSON_PATH = join(PROJECT_PATH, "json")
|
2011-07-16 06:11:20 +00:00
|
|
|
|
|
|
|
# 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.postgresql_psycopg2",
|
|
|
|
"NAME": "best",
|
|
|
|
"USER": "best",
|
|
|
|
"PASSWORD": 'SMSbest',
|
|
|
|
"HOST": "localhost",
|
|
|
|
"PORT": "5432"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-09-13 22:30:34 +00:00
|
|
|
LOCAL_DEVELOPMENT = False
|
2011-07-16 06:11:20 +00:00
|
|
|
# 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 = {
|
|
|
|
"att": {
|
|
|
|
"ENGINE": "rapidsms.backends.gsm",
|
|
|
|
"PORT": "/dev/ttyS0",
|
|
|
|
"baudrate": 115200,
|
|
|
|
"timeout": 5
|
|
|
|
},
|
|
|
|
#"verizon": {
|
|
|
|
# "ENGINE": "rapidsms.backends.gsm,
|
|
|
|
# "PORT": "/dev/ttyUSB1"
|
|
|
|
#},
|
|
|
|
"message_tester": {
|
|
|
|
"ENGINE": "rapidsms.backends.bucket"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-07-23 14:10:49 +00:00
|
|
|
MEDIA_ROOT = join(PROJECT_PATH, 'static')
|
2011-07-16 06:11:20 +00:00
|
|
|
|
|
|
|
# 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 = [
|
|
|
|
|
|
|
|
# the essentials.
|
|
|
|
"django_nose",
|
|
|
|
"djtables",
|
|
|
|
"rapidsms",
|
2011-10-12 11:28:13 +00:00
|
|
|
# "new_best",
|
2011-07-23 12:08:39 +00:00
|
|
|
'smsmesn',
|
2011-07-16 06:11:20 +00:00
|
|
|
"django_extensions",
|
|
|
|
# "buses",
|
|
|
|
# common dependencies (which don't clutter up the ui).
|
|
|
|
"rapidsms.contrib.handlers",
|
|
|
|
"rapidsms.contrib.ajax",
|
|
|
|
|
|
|
|
# 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",
|
|
|
|
|
|
|
|
# the rapidsms contrib apps.
|
|
|
|
"rapidsms.contrib.default",
|
|
|
|
"rapidsms.contrib.export",
|
|
|
|
"rapidsms.contrib.httptester",
|
|
|
|
"rapidsms.contrib.locations",
|
|
|
|
"rapidsms.contrib.messagelog",
|
|
|
|
"rapidsms.contrib.messaging",
|
|
|
|
"rapidsms.contrib.registration",
|
|
|
|
"rapidsms.contrib.scheduler",
|
|
|
|
"rapidsms.contrib.echo",
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
# 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.
|
|
|
|
RAPIDSMS_TABS = [
|
2011-10-13 19:31:03 +00:00
|
|
|
("rapidsms.contrib.messagelog.views.message_log", "SMS Log"),
|
2011-09-13 22:30:34 +00:00
|
|
|
# ("rapidsms.contrib.registration.views.registration", "Registration"),
|
|
|
|
# ("rapidsms.contrib.messaging.views.messaging", "Messaging"),
|
|
|
|
# ("rapidsms.contrib.locations.views.locations", "Map"),
|
|
|
|
# ("rapidsms.contrib.scheduler.views.index", "Event Scheduler"),
|
2011-10-13 19:31:03 +00:00
|
|
|
("rapidsms.contrib.httptester.views.generate_identity", "SMS Tester"),
|
2011-07-16 06:11:20 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
# -------------------------------------------------------------------- #
|
|
|
|
# BORING CONFIGURATION #
|
|
|
|
# -------------------------------------------------------------------- #
|
|
|
|
|
|
|
|
|
|
|
|
# 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
|
|
|
|
|
|
|
|
|
|
|
|
# after login (which is handled by django.contrib.auth), redirect to the
|
|
|
|
# dashboard rather than 'accounts/profile' (the default).
|
|
|
|
LOGIN_REDIRECT_URL = "/"
|
|
|
|
|
|
|
|
|
|
|
|
# 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 = "/static/"
|
|
|
|
|
|
|
|
|
|
|
|
# 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 = "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.core.context_processors.auth",
|
|
|
|
"django.core.context_processors.debug",
|
|
|
|
"django.core.context_processors.i18n",
|
|
|
|
"django.core.context_processors.media",
|
|
|
|
"django.core.context_processors.request",
|
|
|
|
]
|
|
|
|
|
2011-10-14 10:30:56 +00:00
|
|
|
TEMPLATE_LOADERS = (
|
|
|
|
'django.template.loaders.filesystem.Loader',
|
|
|
|
'django.template.loaders.app_directories.Loader',
|
|
|
|
'django.template.loaders.eggs.Loader',
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
TEMPLATE_DIRS = (
|
|
|
|
join(PROJECT_PATH, "templates"),
|
|
|
|
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
|
|
|
|
# Always use forward slashes, even on Windows.
|
|
|
|
# Don't forget to use absolute paths, not relative paths.
|
|
|
|
)
|
|
|
|
|
2011-07-16 06:11:20 +00:00
|
|
|
|
|
|
|
# -------------------------------------------------------------------- #
|
|
|
|
# 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",
|
|
|
|
"rapidsms.contrib.httptester",
|
|
|
|
]
|
|
|
|
|
|
|
|
# the project-level url patterns
|
|
|
|
ROOT_URLCONF = "urls"
|
|
|
|
|
|
|
|
try:
|
|
|
|
from local_settings import *
|
|
|
|
except:
|
|
|
|
pass
|
|
|
|
|
|
|
|
# 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)
|