Project

General

Profile

Download (11.6 KB) Statistics
| Branch: | Tag: | Revision:

calebasse / calebasse / settings.py @ 78bae9a3

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