1
|
# -*- coding: utf-8 -*-
|
2
|
|
3
|
# Django settings for calebasse project.
|
4
|
|
5
|
import os
|
6
|
from django.core.exceptions import ImproperlyConfigured
|
7
|
from logging.handlers import SysLogHandler
|
8
|
|
9
|
PROJECT_PATH = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'calebasse')
|
10
|
|
11
|
DEBUG = True
|
12
|
TEMPLATE_DEBUG = True
|
13
|
|
14
|
ADMINS = (
|
15
|
# ('Your Name', 'your_email@example.com'),
|
16
|
)
|
17
|
|
18
|
MANAGERS = ADMINS
|
19
|
|
20
|
DATABASES = {
|
21
|
'default': {
|
22
|
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
|
23
|
'NAME': os.path.join(PROJECT_PATH, 'calebasse.sqlite3'), # Or path to database file if using sqlite3.
|
24
|
'USER': '', # Not used with sqlite3.
|
25
|
'PASSWORD': '', # Not used with sqlite3.
|
26
|
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
|
27
|
'PORT': '', # Set to empty string for default. Not used with sqlite3.
|
28
|
}
|
29
|
}
|
30
|
|
31
|
# Local time zone for this installation. Choices can be found here:
|
32
|
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
|
33
|
# although not all choices may be available on all operating systems.
|
34
|
# On Unix systems, a value of None will cause Django to use the same
|
35
|
# timezone as the operating system.
|
36
|
# If running in a Windows environment this must be set to the same as your
|
37
|
# system time zone.
|
38
|
TIME_ZONE = 'Europe/Paris'
|
39
|
|
40
|
# Language code for this installation. All choices can be found here:
|
41
|
# http://www.i18nguy.com/unicode/language-identifiers.html
|
42
|
LANGUAGE_CODE = 'fr-fr'
|
43
|
|
44
|
SITE_ID = 1
|
45
|
|
46
|
# If you set this to False, Django will make some optimizations so as not
|
47
|
# to load the internationalization machinery.
|
48
|
USE_I18N = True
|
49
|
|
50
|
# If you set this to False, Django will not format dates, numbers and
|
51
|
# calendars according to the current locale.
|
52
|
USE_L10N = True
|
53
|
FORMAT_MODULE_PATH = 'calebasse.formats'
|
54
|
|
55
|
# If you set this to False, Django will not use timezone-aware datetimes.
|
56
|
USE_TZ = False
|
57
|
|
58
|
# Absolute filesystem path to the directory that will hold user-uploaded files.
|
59
|
# Example: "/home/media/media.lawrence.com/media/"
|
60
|
MEDIA_ROOT = os.path.join(PROJECT_PATH, 'media')
|
61
|
|
62
|
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
|
63
|
# trailing slash.
|
64
|
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
|
65
|
MEDIA_URL = '/media/'
|
66
|
|
67
|
# Absolute path to the directory static files should be collected to.
|
68
|
# Don't put anything in this directory yourself; store your static files
|
69
|
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
|
70
|
# Example: "/home/media/media.lawrence.com/static/"
|
71
|
STATIC_ROOT = os.path.join(os.path.join(PROJECT_PATH, '..'), 'static')
|
72
|
|
73
|
# URL prefix for static files.
|
74
|
# Example: "http://media.lawrence.com/static/"
|
75
|
STATIC_URL = '/static/'
|
76
|
|
77
|
# Additional locations of static files
|
78
|
STATICFILES_DIRS = (
|
79
|
# Put strings here, like "/home/html/static" or "C:/www/django/static".
|
80
|
# Always use forward slashes, even on Windows.
|
81
|
# Don't forget to use absolute paths, not relative paths.
|
82
|
os.path.join(PROJECT_PATH, 'static'),
|
83
|
)
|
84
|
|
85
|
# List of finder classes that know how to find static files in
|
86
|
# various locations.
|
87
|
STATICFILES_FINDERS = (
|
88
|
'django.contrib.staticfiles.finders.FileSystemFinder',
|
89
|
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
90
|
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
|
91
|
)
|
92
|
|
93
|
# Make this unique, and don't share it with anybody.
|
94
|
SECRET_KEY = 'ct(a@ny^_)8v-^)jkdzbktqg6ajfn6y!zdjum^(f_o!h0jeotq'
|
95
|
|
96
|
# List of callables that know how to import templates from various sources.
|
97
|
TEMPLATE_LOADERS = (
|
98
|
'django.template.loaders.filesystem.Loader',
|
99
|
'django.template.loaders.app_directories.Loader',
|
100
|
# 'django.template.loaders.eggs.Loader',
|
101
|
)
|
102
|
|
103
|
MIDDLEWARE_CLASSES = (
|
104
|
'django.middleware.common.CommonMiddleware',
|
105
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
106
|
'django.middleware.csrf.CsrfViewMiddleware',
|
107
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
108
|
'django.contrib.messages.middleware.MessageMiddleware',
|
109
|
#'debug_toolbar.middleware.DebugToolbarMiddleware',
|
110
|
'calebasse.middleware.request.GlobalRequestMiddleware',
|
111
|
# Uncomment the next line for simple clickjacking protection:
|
112
|
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
113
|
'django.middleware.transaction.TransactionMiddleware',
|
114
|
'reversion.middleware.RevisionMiddleware',
|
115
|
# Entr'ouvert wsgi middleware to expose version
|
116
|
'entrouvert.djommon.middleware.VersionMiddleware',
|
117
|
'django_journal.middleware.JournalMiddleware',
|
118
|
)
|
119
|
|
120
|
ROOT_URLCONF = 'calebasse.urls'
|
121
|
|
122
|
# Python dotted path to the WSGI application used by Django's runserver.
|
123
|
WSGI_APPLICATION = 'calebasse.wsgi.application'
|
124
|
|
125
|
TEMPLATE_DIRS = (
|
126
|
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
|
127
|
# Always use forward slashes, even on Windows.
|
128
|
# Don't forget to use absolute paths, not relative paths.
|
129
|
os.path.join(PROJECT_PATH, "templates"),
|
130
|
)
|
131
|
|
132
|
TEMPLATE_CONTEXT_PROCESSORS = ("django.contrib.auth.context_processors.auth",
|
133
|
"django.core.context_processors.debug",
|
134
|
"django.core.context_processors.i18n",
|
135
|
"django.core.context_processors.media",
|
136
|
"django.core.context_processors.static",
|
137
|
"django.core.context_processors.tz",
|
138
|
"django.core.context_processors.request",
|
139
|
"django.contrib.messages.context_processors.messages")
|
140
|
|
141
|
FIXTURE_DIRS = (
|
142
|
os.path.join(PROJECT_PATH, 'fixtures'),
|
143
|
)
|
144
|
|
145
|
INSTALLED_APPS = (
|
146
|
'django.contrib.auth',
|
147
|
'django.contrib.contenttypes',
|
148
|
'django.contrib.sessions',
|
149
|
'django.contrib.sites',
|
150
|
'django.contrib.messages',
|
151
|
'django.contrib.staticfiles',
|
152
|
'reversion',
|
153
|
'south',
|
154
|
'django.contrib.admin',
|
155
|
'ajax_select',
|
156
|
'django_select2',
|
157
|
#'debug_toolbar',
|
158
|
'widget_tweaks',
|
159
|
# Uncomment the next line to enable admin documentation:
|
160
|
# 'django.contrib.admindocs',
|
161
|
'calebasse.agenda',
|
162
|
'calebasse.dossiers',
|
163
|
'calebasse.actes',
|
164
|
'calebasse.facturation',
|
165
|
'calebasse.personnes',
|
166
|
'calebasse.ressources',
|
167
|
'calebasse.statistics',
|
168
|
'calebasse.common',
|
169
|
'calebasse.middleware.request',
|
170
|
'south',
|
171
|
'django_journal',
|
172
|
)
|
173
|
|
174
|
INTERNAL_IPS=('127.0.0.1',)
|
175
|
DEBUG_TOOLBAR_CONFIG = {
|
176
|
'INTERCEPT_REDIRECTS': False,
|
177
|
}
|
178
|
|
179
|
# A sample logging configuration. The only tangible logging
|
180
|
# performed by this configuration is to send an email to
|
181
|
# the site admins on every HTTP 500 error when DEBUG=False.
|
182
|
# See http://docs.djangoproject.com/en/dev/topics/logging for
|
183
|
# more details on how to customize your logging configuration.
|
184
|
LOGGING = {
|
185
|
'version': 1,
|
186
|
'disable_existing_loggers': True,
|
187
|
'filters': {
|
188
|
'require_debug_false': {
|
189
|
'()': 'django.utils.log.RequireDebugFalse'
|
190
|
},
|
191
|
},
|
192
|
'formatters': {
|
193
|
'verbose': {
|
194
|
'format': '[%(asctime)s] %(levelname)-8s %(name)s.%(message)s',
|
195
|
'datefmt': '%Y-%m-%d %a %H:%M:%S'
|
196
|
},
|
197
|
'syslog': {
|
198
|
'format': 'calebasse (pid=%(process)d) %(levelname)s %(name)s: %(message)s',
|
199
|
},
|
200
|
},
|
201
|
'handlers': {
|
202
|
'mail_admins': {
|
203
|
'level': 'ERROR',
|
204
|
'filters': ['require_debug_false'],
|
205
|
'class': 'django.utils.log.AdminEmailHandler'
|
206
|
},
|
207
|
'console': {
|
208
|
'level':'INFO',
|
209
|
'class':'logging.StreamHandler',
|
210
|
'formatter': 'verbose',
|
211
|
},
|
212
|
'syslog': {
|
213
|
'level': 'DEBUG',
|
214
|
'class': 'entrouvert.logging.handlers.SysLogHandler',
|
215
|
'formatter': 'syslog',
|
216
|
'facility': SysLogHandler.LOG_LOCAL0,
|
217
|
'address': '/dev/log',
|
218
|
'max_length': 999,
|
219
|
},
|
220
|
},
|
221
|
'loggers': {
|
222
|
'django.db.backends': {
|
223
|
'level': 'ERROR',
|
224
|
'handlers': ['console'],
|
225
|
'propagate': False,
|
226
|
},
|
227
|
'': {
|
228
|
'handlers': ['syslog'],
|
229
|
'level': 'DEBUG' if DEBUG else 'INFO',
|
230
|
'propagate': True,
|
231
|
}
|
232
|
},
|
233
|
}
|
234
|
|
235
|
# AJAX Select
|
236
|
AJAX_LOOKUP_CHANNELS = {
|
237
|
# pass a dict with the model and the field to search against
|
238
|
'worker' : ('calebasse.personnes.lookup', 'WorkerLookup'),
|
239
|
'intervenant' : ('calebasse.personnes.lookup', 'IntervenantLookup'),
|
240
|
#'patientrecord' : {'model':'dossiers.PatientRecord', 'search_field':'display_name'}
|
241
|
#'coordinators' : {'model':'dossiers.PatientRecord', 'search_field':'display_name'}
|
242
|
'patientrecord' : ('calebasse.dossiers.lookups', 'PatientRecordLookup'),
|
243
|
#'school' : {'model':'ressources.School', 'search_field':'name'},
|
244
|
'school' : ('calebasse.ressources.lookups', 'SchoolLookup'),
|
245
|
'addresses' : ('calebasse.dossiers.lookups', 'PatientAddressLookup'),
|
246
|
'worker-or-group' : ('calebasse.ressources.lookups', 'WorkerOrGroupLookup'),
|
247
|
'all-worker-or-group' : ('calebasse.ressources.lookups', 'AllWorkerOrGroupLookup'),
|
248
|
}
|
249
|
|
250
|
# South configuration
|
251
|
SOUTH_TESTS_MIGRATE = False
|
252
|
|
253
|
# Default URL after login
|
254
|
LOGIN_REDIRECT_URL = '/'
|
255
|
|
256
|
# Sentry / raven configuration
|
257
|
# You need to overload this option in the local_settings.py
|
258
|
RAVEN_CONFIG = None
|
259
|
|
260
|
# Base directory for generated patient files
|
261
|
PATIENT_FILES_BASE_DIRECTORY = None
|
262
|
|
263
|
# Client side base directory for generated patient files
|
264
|
CLIENT_SIDE_PATIENT_FILES_BASE_DIRECTORY = None
|
265
|
|
266
|
# Patient subdirectories
|
267
|
PATIENT_SUBDIRECTORIES = (
|
268
|
u'Assistante sociale',
|
269
|
u'Consultation',
|
270
|
u'Courriers',
|
271
|
u'Demande',
|
272
|
u'Demandes prises en charge',
|
273
|
u'Educateur spécialisé',
|
274
|
u'Ergothérapie',
|
275
|
u'Groupe',
|
276
|
u'Kinésithérapie',
|
277
|
u'Logico-mathématiques',
|
278
|
u'Neuro-psychologie',
|
279
|
u'Orientation',
|
280
|
u'Orthophonie',
|
281
|
u'Psychologie',
|
282
|
u'Psychomotricité',
|
283
|
u'Psychopédagogue',
|
284
|
u'Synthèses',
|
285
|
u'TCC',
|
286
|
)
|
287
|
|
288
|
# RTF templates directory
|
289
|
RTF_TEMPLATES_DIRECTORY = None
|
290
|
# Use patient home dictrory for RTF files generated
|
291
|
# PATIENT_FILES_BASE_DIRECTORY must be set to work
|
292
|
USE_PATIENT_FILE_RTF_REPOSITORY_DIRECTORY = False
|
293
|
# RTF files generated directory
|
294
|
RTF_REPOSITORY_DIRECTORY = None
|
295
|
|
296
|
# Invoicing file saving directory
|
297
|
INVOICING_DIRECTORY = None
|
298
|
|
299
|
# display events only for current service
|
300
|
CURRENT_SERVICE_EVENTS_ONLY = True
|
301
|
|
302
|
# dictionary to define non-default behaviours for some services
|
303
|
SERVICE_SETTINGS = {}
|
304
|
# valid keys
|
305
|
# - show_overlapping_appointments: boolean (default: False)
|
306
|
# - age_format: string, string (default: None, alternative behaviour to have
|
307
|
# age always displayed in months: "months_only")
|
308
|
|
309
|
# Pdftk binary path (pdftk is used to complete CERFA)
|
310
|
PDFTK_PATH = '/usr/bin/pdftk'
|
311
|
|
312
|
|
313
|
#CSV_ENCODING = 'cp1252' #For windows : windows-1252/Winlatin1
|
314
|
#CSVPROFILE = {\
|
315
|
# 'delimiter' : ';',
|
316
|
# 'quotechar' : '"',
|
317
|
# 'doublequote' : True
|
318
|
# 'skipinitialspace' : False
|
319
|
# 'lineterminator' : '\r\n'
|
320
|
# 'quoting' : csv.QUOTE_MINIMAL
|
321
|
#}
|
322
|
|
323
|
# IRIS/B2 transmission
|
324
|
# B2_TRANSMISSION = {
|
325
|
# 'output_directory': '/var/lib/calebasse/B2/',
|
326
|
# # B2 informations
|
327
|
# 'nom': 'CMPP FOOBAR', # mandatory
|
328
|
# 'numero_emetteur': '123456789', # mandatory
|
329
|
# 'norme': 'CP ',
|
330
|
# 'type_emetteur': 'TE',
|
331
|
# 'application': 'TR',
|
332
|
# 'categorie': '189',
|
333
|
# 'statut': '60',
|
334
|
# 'mode_tarif': '05',
|
335
|
# 'message': 'ENTROUVERT 0143350135 CALEBASSE 1307',
|
336
|
# # SMTP configuration
|
337
|
# 'smtp_from': 'transmission@domain.net', # mandatory
|
338
|
# 'smtp_host': '127.0.0.1',
|
339
|
# 'smtp_port': 25,
|
340
|
# 'smtp_login': '',
|
341
|
# 'smtp_password': '',
|
342
|
# # delay between two mails, in seconds, or None
|
343
|
# 'smtp_delay': None,
|
344
|
# }
|
345
|
|
346
|
try:
|
347
|
from local_settings import *
|
348
|
except ImportError:
|
349
|
print """
|
350
|
-------------------------------------------------------------------------
|
351
|
You need to create a local_settings.py file which needs to contain at least
|
352
|
database connection information.
|
353
|
|
354
|
Copy local_settings_example.py to local_settings.py and edit it.
|
355
|
-------------------------------------------------------------------------
|
356
|
"""
|
357
|
import sys
|
358
|
sys.exit(1)
|
359
|
|
360
|
if not os.path.exists(PDFTK_PATH):
|
361
|
raise ImproperlyConfigured("pdftk %r binary not found" % PDFTK_PATH)
|
362
|
|
363
|
if RAVEN_CONFIG:
|
364
|
INSTALLED_APPS += ('raven.contrib.django.raven_compat', )
|
365
|
LOGGING['handlers']['sentry'] = {
|
366
|
'level': 'ERROR',
|
367
|
'class': 'raven.contrib.django.raven_compat.handlers.SentryHandler',
|
368
|
}
|
369
|
LOGGING['loggers']['raven'] = {
|
370
|
'level': 'DEBUG',
|
371
|
'handlers': ['console'],
|
372
|
'propagate': False,
|
373
|
}
|
374
|
LOGGING['loggers']['sentry.errors'] = {
|
375
|
'level': 'DEBUG',
|
376
|
'handlers': ['console'],
|
377
|
'propagate': False,
|
378
|
}
|
379
|
LOGGING['loggers']['']['handlers'].append('sentry')
|