271 lines
9.1 KiB
Python
271 lines
9.1 KiB
Python
# -*- encoding: utf-8 -*-
|
|
|
|
import os.path
|
|
|
|
def gettext_noop(x):
|
|
return x
|
|
|
|
DEBUG = False
|
|
|
|
ROOT_PATH = os.path.abspath(
|
|
os.path.join(os.path.dirname(__file__), '..', '..'))
|
|
|
|
DATABASES = {
|
|
'default': {
|
|
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
|
'NAME': 'docbow',
|
|
},
|
|
'log': {
|
|
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
|
'NAME': 'docbow',
|
|
}
|
|
}
|
|
|
|
# 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.
|
|
# On Unix systems, a value of None will cause Django to use the same
|
|
# timezone as the operating system.
|
|
# If running in a Windows environment this must be set to the same as your
|
|
# system time zone.
|
|
TIME_ZONE = 'Europe/Paris'
|
|
|
|
# Language code for this installation. All choices can be found here:
|
|
# http://www.i18nguy.com/unicode/language-identifiers.html
|
|
LANGUAGE_CODE = 'fr'
|
|
LANGUAGES = (('fr', gettext_noop('French')),)
|
|
|
|
SITE_ID = 1
|
|
|
|
# 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
|
|
|
|
ROOT_URLCONF = 'docbow_project.urls'
|
|
|
|
INSTALLED_APPS = (
|
|
'django.contrib.contenttypes',
|
|
'django.contrib.auth',
|
|
'django.contrib.sessions',
|
|
'django.contrib.messages',
|
|
'django.contrib.staticfiles',
|
|
'django.contrib.humanize',
|
|
# Uncomment the next line to enable the admin:
|
|
'grappelli',
|
|
'django.contrib.admin',
|
|
# Uncomment the next line to enable admin documentation:
|
|
# 'django.contrib.admindocs',
|
|
'django_journal',
|
|
'docbow_project.docbow',
|
|
'uni_form',
|
|
'tinymce',
|
|
'south',
|
|
)
|
|
|
|
# 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',
|
|
)
|
|
|
|
MIDDLEWARE_CLASSES = (
|
|
'django.middleware.common.CommonMiddleware',
|
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
|
'django.middleware.locale.LocaleMiddleware',
|
|
'django.middleware.csrf.CsrfViewMiddleware',
|
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
|
'django.contrib.messages.middleware.MessageMiddleware',
|
|
'django_journal.middleware.JournalMiddleware',
|
|
'docbow_project.docbow.middleware.KeepUserAroundMiddleware',
|
|
'django.middleware.transaction.TransactionMiddleware',
|
|
)
|
|
|
|
GRAPPELLI_ADMIN_TITLE = u"Administration de la plate-forme d'échange sécurisée du Parlement wallon"
|
|
|
|
FILE_PER_PAGE = 30
|
|
TINYMCE_SPELLCHECKER = True
|
|
TINYMCE_JS_URL = "/static/js/tiny_mce/tiny_mce_src.js"
|
|
TINYMCE_COMPRESSOR = True
|
|
|
|
TINYMCE_DEFAULT_CONFIG = {
|
|
'theme': "advanced",
|
|
}
|
|
|
|
DOCBOW_MENU = [
|
|
('send-file', gettext_noop('send-file_menu')),
|
|
('inbox', gettext_noop('inbox_menu')),
|
|
('outbox', gettext_noop('outbox_menu')),
|
|
('docbow_admin:index', gettext_noop('admin_menu')),
|
|
('profile', gettext_noop('profile_menu')),
|
|
('auth_password_change', gettext_noop('password_change_menu')),
|
|
('delegate', gettext_noop('delegate_menu')),
|
|
('mailing-lists', gettext_noop('mailing-lists')),
|
|
('help', gettext_noop('help_menu')),
|
|
('contact', gettext_noop('contact_menu')),
|
|
]
|
|
|
|
# Groups to exclude from the send file form
|
|
DO_NOT_SEND_GROUPS = (
|
|
u'Administrateurs des groupes',
|
|
u'Administrateurs des types de document',
|
|
u'Administrateurs des utilisateurs',
|
|
u"Utilisateurs de l'application" )
|
|
|
|
TEMPLATE_DIRS = (os.path.join(ROOT_PATH, 'docbow_project', 'templates'), '/var/lib/docbow/templates/')
|
|
|
|
LOCALE_PATHS = (os.path.join(ROOT_PATH, 'docbow_project', 'locale'),)
|
|
CONTACT_GROUPS = (u'Contact « Administrateur du système »',)
|
|
|
|
# Absolute filesystem path to the directory that will hold user-uploaded files.
|
|
# Example: "/home/media/media.lawrence.com/media/"
|
|
MEDIA_ROOT = os.path.join(ROOT_PATH, '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 = ''
|
|
|
|
# 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.path.join(ROOT_PATH, 'static')
|
|
|
|
# URL prefix for static files.
|
|
# Example: "http://media.lawrence.com/static/"
|
|
STATIC_URL = '/static/'
|
|
|
|
# URL prefix for admin static files -- CSS, JavaScript and images.
|
|
# Make sure to use a trailing slash.
|
|
# Examples: "http://foo.com/static/admin/", "/static/admin/".
|
|
ADMIN_MEDIA_PREFIX = STATIC_URL + 'grappelli/'
|
|
|
|
# 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.
|
|
'/var/lib/docbow/extra_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',
|
|
)
|
|
LOGIN_REDIRECT_URL = '/inbox'
|
|
|
|
MESSAGE_STORAGE = 'django.contrib.messages.storage.fallback.FallbackStorage'
|
|
|
|
DEFAULT_FROM_EMAIL = 'admin@example.com'
|
|
CONTACT_SUBJECT_PREFIX = 'Contact depuis docbow: '
|
|
|
|
ALLOWED_HOSTS = ['*']
|
|
|
|
# A sample logging configuration. The only tangible logging
|
|
# performed by this configuration is to send an email to
|
|
# the site admins on every HTTP 500 error.
|
|
# 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': True,
|
|
'formatters': {
|
|
'verbose': {
|
|
'format': '%(name)s %(levelname)s %(asctime)s %(module)s.%(funcName)s: %(message)s'
|
|
},
|
|
'simple': {
|
|
'format': '%(name)s %(levelname)s %(asctime)s %(module)s.%(funcName)s IP:%(ip)s USER:%(user)s %(message)s'
|
|
},
|
|
'simple_no_ip': {
|
|
'format': '%(name)s %(levelname)s %(asctime)s %(module)s.%(funcName)s %(message)s'
|
|
},
|
|
},
|
|
'handlers': {
|
|
'mail_admins': {
|
|
'level': 'ERROR',
|
|
'class': 'django.utils.log.AdminEmailHandler',
|
|
'include_html': True,
|
|
},
|
|
'normal.log': {
|
|
'level': 'INFO',
|
|
'class': 'logging.handlers.RotatingFileHandler',
|
|
'formatter': 'simple_no_ip',
|
|
'filename': os.path.join(ROOT_PATH, '..', 'normal.log'),
|
|
'maxBytes': 1024*1024,
|
|
'backupCount': 30,
|
|
},
|
|
'docbow.log': {
|
|
'level': 'INFO',
|
|
'class': 'logging.handlers.RotatingFileHandler',
|
|
'formatter': 'simple',
|
|
'filename': os.path.join(ROOT_PATH, '..', 'docbow.log'),
|
|
'maxBytes': 1024*1024,
|
|
'backupCount': 30,
|
|
},
|
|
'console': {
|
|
'class': 'logging.StreamHandler',
|
|
'formatter': 'simple_no_ip',
|
|
'level': 'DEBUG',
|
|
},
|
|
},
|
|
'loggers': {
|
|
'docbow.mail_interface': {
|
|
'handlers': [ 'mail_admins', 'normal.log' ],
|
|
'level': 'INFO',
|
|
'propagate': False,
|
|
},
|
|
'docbow': {
|
|
'handlers': [ 'mail_admins', 'normal.log' ],
|
|
'level': 'INFO',
|
|
'propagate': False,
|
|
},
|
|
'': {
|
|
'handlers': [ 'mail_admins', 'normal.log' ],
|
|
'level': 'DEBUG',
|
|
},
|
|
},
|
|
'root': {
|
|
'handlers': [ 'mail_admins', 'normal.log' ],
|
|
'level': 'DEBUG',
|
|
},
|
|
}
|
|
|
|
# LDAP backend configuration
|
|
import ldap
|
|
from django_auth_ldap.config import LDAPSearch, GroupOfUniqueNamesType
|
|
|
|
AUTH_LDAP_SERVER_URI = "ldaps://ldap.libre-entreprise.org:636"
|
|
AUTH_LDAP_BIND_DN = ""
|
|
AUTH_LDAP_BIND_PASSWORD = ""
|
|
AUTH_LDAP_USER_SEARCH = LDAPSearch("ou=people,o=entrouvert,ou=companies,o=libre-entreprise",
|
|
ldap.SCOPE_SUBTREE, "(uid=%(user)s)")
|
|
AUTH_LDAP_GROUP_TYPE = GroupOfUniqueNamesType()
|
|
AUTH_LDAP_GROUP_SEARCH = LDAPSearch("o=libre-entreprise",
|
|
ldap.SCOPE_SUBTREE, "(objectClass=legroup)")
|
|
AUTH_LDAP_USER_FLAGS_BY_GROUP = {
|
|
"is_staff": "cn=ldapadmins,ou=groups,o=entrouvert,ou=companies,o=libre-entreprise",
|
|
"is_superuser": "cn=ldapadmins,ou=groups,o=entrouvert,ou=companies,o=libre-entreprise",
|
|
}
|
|
AUTH_LDAP_USER_ATTR_MAP = {
|
|
"first_name": "givenName",
|
|
"last_name": "sn",
|
|
"email": "mail"
|
|
}
|
|
AUTHENTICATION_BACKENDS = (
|
|
'django_auth_ldap.backend.LDAPBackend',
|
|
'docbow_project.auth_backend.DelegationAuthBackend',
|
|
'django.contrib.auth.backends.ModelBackend' )
|
|
|
|
DOCBOW_NOTIFIERS = (
|
|
'docbow_project.docbow.notification.MailNotifier',
|
|
'docbow_project.docbow.notification.SMSNotifier',
|
|
)
|
|
DOCBOW_SMS_CARRIER_CLASS = 'docbow_project.sms_carrier_ovh.OVHSMSCarrier'
|
|
DOCBOW_ORGANIZATION = '<change the organization field in key DOCBOW_NOTIFICATION_CONTEXT of your local_settings.py file>'
|