mirror of
https://github.com/GFDRR/sms-lapli.git
synced 2026-11-08 07:16:05 +00:00
Add the market place application Start Improving the dashboard Edit the data model to make it more suited to the reality of the CNSA Add Support for Alert and notification Add Import-Export functionality Achieve many minor changes to make the application more ergonomic
314 lines
9.4 KiB
Python
314 lines
9.4 KiB
Python
# Django settings for smslapli project.
|
|
|
|
import os
|
|
|
|
# The top directory for this project. Contains requirements/, manage.py,
|
|
# and README.rst, a smslapli directory with settings etc (see
|
|
# PROJECT_PATH), as well as a directory for each Django app added to this
|
|
# project.
|
|
PROJECT_ROOT = os.path.dirname(os.path.dirname(__file__))
|
|
|
|
# The directory with this project's templates, settings, urls, static dir,
|
|
# wsgi.py, fixtures, etc.
|
|
PROJECT_PATH = os.path.join(PROJECT_ROOT, 'smslapli')
|
|
|
|
DEBUG = True
|
|
TEMPLATE_DEBUG = DEBUG
|
|
|
|
ADMINS = (
|
|
# ('Your Name', 'your_email@example.com'),
|
|
)
|
|
|
|
MANAGERS = ADMINS
|
|
|
|
DATABASES = {
|
|
'default': {
|
|
'ENGINE': 'django.contrib.gis.db.backends.spatialite',
|
|
'NAME': 'smslapli.db',
|
|
}
|
|
|
|
# Config for PostGIS
|
|
# 'default': {
|
|
# 'ENGINE': 'django.contrib.gis.db.backends.postgis',
|
|
# 'NAME': 'base_lapli',
|
|
# 'USER': 'postgres',
|
|
# 'PASSWORD': 'postgres',
|
|
# 'HOST': '127.0.0.1',
|
|
# 'PORT': '3389',
|
|
# }
|
|
|
|
}
|
|
|
|
|
|
|
|
# Local time zone for this installation. Choices can be found here:
|
|
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
|
|
# although not all choices may be available on all operating systems.
|
|
# In a Windows environment this must be set to your system time zone.
|
|
TIME_ZONE = 'America/Chicago'
|
|
|
|
# Language code for this installation. All choices can be found here:
|
|
# http://www.i18nguy.com/unicode/language-identifiers.html
|
|
LANGUAGE_CODE = 'fr'
|
|
|
|
# If you set this to False, Django will make some optimizations so as not
|
|
# to load the internationalization machinery.
|
|
USE_I18N = True
|
|
|
|
# If you set this to False, Django will not format dates, numbers and
|
|
# calendars according to the current locale.
|
|
USE_L10N = True
|
|
|
|
# If you set this to False, Django will not use timezone-aware datetimes.
|
|
USE_TZ = True
|
|
|
|
# Absolute filesystem path to the directory that will hold user-uploaded files.
|
|
# Example: "/home/media/media.lawrence.com/public/media/"
|
|
MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'public', 'media')
|
|
|
|
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
|
|
# trailing slash.
|
|
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
|
|
MEDIA_URL = '/media/'
|
|
|
|
# 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/public/static/"
|
|
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'public', 'static')
|
|
|
|
# URL prefix for static files.
|
|
# Example: "http://media.lawrence.com/static/"
|
|
STATIC_URL = '/static/'
|
|
|
|
# Additional locations of static files to collect
|
|
# STATICFILES_DIRS = (
|
|
# [],
|
|
# os.path.join(PROJECT_ROOT, 'static'),
|
|
# )
|
|
|
|
# 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',
|
|
)
|
|
|
|
# Make this unique, and don't share it with anybody.
|
|
SECRET_KEY = '0k^@f)raql%=@)#7q251w$l(590dx_fjzuq9*+58u*r48q*$wc'
|
|
|
|
# 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',
|
|
)
|
|
|
|
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.static',
|
|
'django.core.context_processors.tz',
|
|
'django.core.context_processors.request',
|
|
'django.contrib.messages.context_processors.messages',
|
|
|
|
)
|
|
|
|
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.static',
|
|
'django.core.context_processors.tz',
|
|
'django.core.context_processors.request',
|
|
'django.contrib.messages.context_processors.messages',
|
|
'smslapli.context_processors.get_infos',
|
|
#'smslapli.context_processors.app_list',
|
|
)
|
|
|
|
MIDDLEWARE_CLASSES = (
|
|
'django.middleware.common.CommonMiddleware',
|
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
|
'django.middleware.csrf.CsrfViewMiddleware',
|
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
|
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
|
|
'django.contrib.messages.middleware.MessageMiddleware',
|
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
|
'admin_reorder.middleware.ModelAdminReorder',
|
|
)
|
|
|
|
ROOT_URLCONF = 'smslapli.urls'
|
|
|
|
# Python dotted path to the WSGI application used by Django's runserver.
|
|
WSGI_APPLICATION = 'smslapli.wsgi.application'
|
|
|
|
TEMPLATE_DIRS = (
|
|
os.path.join(PROJECT_PATH, 'templates'),
|
|
)
|
|
|
|
FIXTURE_DIRS = (
|
|
os.path.join(PROJECT_PATH, 'fixtures'),
|
|
)
|
|
|
|
# A sample logging configuration.
|
|
# This logs all rapidsms messages to the file `rapidsms.log`
|
|
# in the project directory. It also sends an email to
|
|
# the site admins on every HTTP 500 error when DEBUG=False.
|
|
# See http://docs.djangoproject.com/en/dev/topics/logging for
|
|
# more details on how to customize your logging configuration.
|
|
LOGGING = {
|
|
'version': 1,
|
|
'disable_existing_loggers': False,
|
|
'filters': {
|
|
'require_debug_false': {
|
|
'()': 'django.utils.log.RequireDebugFalse'
|
|
}
|
|
},
|
|
'formatters': {
|
|
'basic': {
|
|
'format': '%(asctime)s %(name)-20s %(levelname)-8s %(message)s',
|
|
},
|
|
},
|
|
'handlers': {
|
|
'mail_admins': {
|
|
'level': 'ERROR',
|
|
'filters': ['require_debug_false'],
|
|
'class': 'django.utils.log.AdminEmailHandler'
|
|
},
|
|
'console': {
|
|
'level': 'DEBUG',
|
|
'class': 'logging.StreamHandler',
|
|
'formatter': 'basic',
|
|
},
|
|
'file': {
|
|
'level': 'DEBUG',
|
|
'class': 'logging.FileHandler',
|
|
'formatter': 'basic',
|
|
'filename': os.path.join(PROJECT_PATH, 'rapidsms.log'),
|
|
},
|
|
},
|
|
'loggers': {
|
|
'django.request': {
|
|
'handlers': ['mail_admins'],
|
|
'level': 'ERROR',
|
|
'propagate': True,
|
|
},
|
|
'rapidsms': {
|
|
'handlers': ['file'],
|
|
'level': 'DEBUG',
|
|
'propagate': True,
|
|
},
|
|
}
|
|
}
|
|
|
|
#JET_DEFAULT_THEME = 'green'
|
|
|
|
INSTALLED_APPS = (
|
|
'django.contrib.auth',
|
|
'django.contrib.contenttypes',
|
|
'django.contrib.sessions',
|
|
'django.contrib.messages',
|
|
'django.contrib.staticfiles',
|
|
# 'mod_wsgi.server',
|
|
'suit',
|
|
#'jet.dashboard',
|
|
#'jet',
|
|
'django.contrib.admin',
|
|
'django.contrib.humanize',
|
|
'django.contrib.sitemaps',
|
|
'django.contrib.gis',
|
|
|
|
# External apps
|
|
'django_tables2',
|
|
'selectable',
|
|
'geoposition',
|
|
'import_export',
|
|
|
|
# RapidSMS
|
|
'rapidsms',
|
|
'admin_reorder',
|
|
'rapidsms.backends.database',
|
|
'rapidsms.contrib.handlers',
|
|
'rapidsms.contrib.httptester',
|
|
'rapidsms.contrib.messagelog',
|
|
'rapidsms.contrib.messaging',
|
|
'rapidsms.contrib.registration',
|
|
#"rapidsms.contrib.echo',
|
|
|
|
# SMS Lapli Apps
|
|
'base',
|
|
'hydromet',
|
|
'public',
|
|
'rapport',
|
|
'prix_marche',
|
|
'sms_gateway', #This is the one who will be used to handle sms
|
|
|
|
# Must Be last
|
|
'rapidsms.contrib.default',
|
|
)
|
|
|
|
INSTALLED_BACKENDS = {
|
|
"message_tester": {
|
|
"ENGINE": "rapidsms.backends.database.DatabaseBackend",
|
|
},
|
|
|
|
"kannel-usb0-smsc" : {
|
|
"ENGINE": "rapidsms.backends.kannel.KannelBackend",
|
|
"sendsms_url": "http://127.0.0.1:14000/cgi-bin/sendsms",
|
|
"sendsms_params": {"smsc": "usb0-modem",
|
|
"from": "+50934772370", # not set automatically by SMSC
|
|
"username": "rapidsms",
|
|
"password": "CHANGE-ME"}, # or set in localsettings.py
|
|
"coding": 0,
|
|
"charset": "ascii",
|
|
"encode_errors": "ignore", # strip out unknown (unicode) characters
|
|
},
|
|
}
|
|
|
|
DEFAULT_RESPONSE = "Message incorrect!"
|
|
LOGIN_REDIRECT_URL = '/'
|
|
|
|
RAPIDSMS_HANDLERS = (
|
|
'rapidsms.contrib.echo.handlers.echo.EchoHandler',
|
|
'tut.myhandlers.HelpHandler',
|
|
'tut.myhandlers.SumHandler',
|
|
)
|
|
|
|
ADMIN_REORDER = (
|
|
('auth'),
|
|
)
|
|
|
|
SUIT_CONFIG = {
|
|
'ADMIN_NAME': '<img src="https://dl.dropboxusercontent.com/s/fjerjqw4hz1x6lk/LogoSMSLapli_small.png?dl=0" width="31" height="30" style="float: left;"> <span style="display:inline-block; margin-top: 5px;">SMS Lapli</span>',
|
|
'LIST_PER_PAGE': 20,
|
|
'SEARCH_URL': '',
|
|
'MENU': (
|
|
|
|
# Separator
|
|
'-',
|
|
|
|
# Rename app and set icon
|
|
{'app': 'hydromet', 'icon':'icon-tint', 'models': ({'label':'Rapport', 'url':'/admin/hydromet/rapport/'},'Observation', 'Station', 'ObservateurHydromet', 'TypeObservation', 'TypeStation', 'Log', 'Alerte')},
|
|
|
|
{'app': 'prix_marche', 'icon':'icon-briefcase', 'models': ('Marche', 'ObservateurPrixMarche', 'ObservationDePrix', 'Produit', 'TypeMarche', 'TypeProduit', 'NiveauOffre')},
|
|
|
|
# Separator
|
|
'-',
|
|
|
|
# Reorder app models
|
|
{'app': 'base', 'icon':'icon-th-list', 'models': ('Personne', 'Observatoire', 'Poste', 'UniteMesure', 'Limite', 'TypeLimite')},
|
|
|
|
# Reorder app models
|
|
{'app': 'auth', 'icon':'icon-user', 'label': 'Authentification et Droits', 'models': ('user', 'group')},
|
|
|
|
'-',
|
|
{'label':'Voir le site', 'icon':'icon-globe', 'url':'/'},
|
|
'-',
|
|
|
|
|
|
)
|
|
}
|
|
|