Project

General

Profile

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

calebasse / calebasse / settings.py @ 73afaff3

1
# -*- coding: utf-8 -*-
2

    
3
# Django settings for calebasse project.
4

    
5
import os
6
from logging.handlers import SysLogHandler
7

    
8
PROJECT_PATH = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'calebasse')
9

    
10
DEBUG = True
11
TEMPLATE_DEBUG = True
12

    
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
        'NAME': os.path.join(PROJECT_PATH, 'calebasse.sqlite3'),                      # Or path to database file if using sqlite3.
23
        '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
FORMAT_MODULE_PATH = 'calebasse.formats'
53

    
54
# If you set this to False, Django will not use timezone-aware datetimes.
55
USE_TZ = False
56

    
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
STATIC_ROOT = os.path.join(os.path.join(PROJECT_PATH, '..'), 'static')
71

    
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
    os.path.join(PROJECT_PATH, 'static'),
82
)
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
    #'debug_toolbar.middleware.DebugToolbarMiddleware',
109
    'calebasse.middleware.request.GlobalRequestMiddleware',
110
    # Uncomment the next line for simple clickjacking protection:
111
    # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
112
    'django.middleware.transaction.TransactionMiddleware',
113
    'reversion.middleware.RevisionMiddleware',
114
    # Entr'ouvert wsgi middleware to expose version
115
    'entrouvert.djommon.middleware.VersionMiddleware',
116
    'django_journal.middleware.JournalMiddleware',
117
)
118

    
119
ROOT_URLCONF = 'calebasse.urls'
120

    
121
# Python dotted path to the WSGI application used by Django's runserver.
122
WSGI_APPLICATION = 'calebasse.wsgi.application'
123

    
124
TEMPLATE_DIRS = (
125
    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
126
    # Always use forward slashes, even on Windows.
127
    # Don't forget to use absolute paths, not relative paths.
128
    os.path.join(PROJECT_PATH, "templates")
129
)
130

    
131
TEMPLATE_CONTEXT_PROCESSORS = ("django.contrib.auth.context_processors.auth",
132
    "django.core.context_processors.debug",
133
    "django.core.context_processors.i18n",
134
    "django.core.context_processors.media",
135
    "django.core.context_processors.static",
136
    "django.core.context_processors.tz",
137
    "django.core.context_processors.request",
138
    "django.contrib.messages.context_processors.messages")
139

    
140
FIXTURE_DIRS = (
141
        os.path.join(PROJECT_PATH, 'fixtures'),
142
)
143

    
144
INSTALLED_APPS = (
145
    'django.contrib.auth',
146
    'django.contrib.contenttypes',
147
    'django.contrib.sessions',
148
    'django.contrib.sites',
149
    'django.contrib.messages',
150
    'django.contrib.staticfiles',
151
    'reversion',
152
    'south',
153
    'django.contrib.admin',
154
    'ajax_select',
155
    'django_select2',
156
    #'debug_toolbar',
157
    'widget_tweaks',
158
    # Uncomment the next line to enable admin documentation:
159
    # 'django.contrib.admindocs',
160
    'calebasse.agenda',
161
    'calebasse.dossiers',
162
    'calebasse.actes',
163
    'calebasse.facturation',
164
    'calebasse.personnes',
165
    'calebasse.ressources',
166
    'calebasse.statistics',
167
    'calebasse.common',
168
    'calebasse.middleware.request',
169
    'south',
170
    'django_journal',
171
)
172

    
173
INTERNAL_IPS=('127.0.0.1',)
174
DEBUG_TOOLBAR_CONFIG = {
175
    'INTERCEPT_REDIRECTS': False,
176
}
177

    
178
# A sample logging configuration. The only tangible logging
179
# performed by this configuration is to send an email to
180
# the site admins on every HTTP 500 error when DEBUG=False.
181
# See http://docs.djangoproject.com/en/dev/topics/logging for
182
# more details on how to customize your logging configuration.
183
LOGGING = {
184
    'version': 1,
185
    'disable_existing_loggers': True,
186
    'filters': {
187
        'require_debug_false': {
188
            '()': 'django.utils.log.RequireDebugFalse'
189
        },
190
    },
191
    'formatters': {
192
        'verbose': {
193
            'format': '[%(asctime)s] %(levelname)-8s %(name)s.%(message)s',
194
            'datefmt': '%Y-%m-%d %a %H:%M:%S'
195
        },
196
        'syslog': {
197
            'format': 'calebasse (pid=%(process)d) %(levelname)s %(name)s: %(message)s',
198
        },
199
    },
200
    'handlers': {
201
        'mail_admins': {
202
            'level': 'ERROR',
203
            'filters': ['require_debug_false'],
204
            'class': 'django.utils.log.AdminEmailHandler'
205
        },
206
        'console': {
207
            'level':'INFO',
208
            'class':'logging.StreamHandler',
209
            'formatter': 'verbose',
210
        },
211
        'syslog': {
212
            'level': 'DEBUG',
213
            'class': 'entrouvert.logging.handlers.SysLogHandler',
214
            'formatter': 'syslog',
215
            'facility': SysLogHandler.LOG_LOCAL0,
216
            'address': '/dev/log',
217
            'max_length': 999,
218
        },
219
    },
220
    'loggers': {
221
        'django.db.backends': {
222
            'level': 'ERROR',
223
            'handlers': ['console'],
224
            'propagate': False,
225
        },
226
        '': {
227
            'handlers': ['syslog'],
228
            'level': 'DEBUG' if DEBUG else 'INFO',
229
            'propagate': True,
230
        }
231
    },
232
}
233

    
234
# AJAX Select
235
AJAX_LOOKUP_CHANNELS = {
236
    #   pass a dict with the model and the field to search against
237
    'worker' : ('calebasse.personnes.lookup', 'WorkerLookup'),
238
    'intervenant' : ('calebasse.personnes.lookup', 'IntervenantLookup'),
239
    #'patientrecord'  : {'model':'dossiers.PatientRecord', 'search_field':'display_name'}
240
    #'coordinators'  : {'model':'dossiers.PatientRecord', 'search_field':'display_name'}
241
    'patientrecord' : ('calebasse.dossiers.lookups', 'PatientRecordLookup'),
242
    #'school' : {'model':'ressources.School', 'search_field':'name'},
243
    'school' : ('calebasse.ressources.lookups', 'SchoolLookup'),
244
    'addresses' : ('calebasse.dossiers.lookups', 'PatientAddressLookup'),
245
    'worker-or-group' : ('calebasse.ressources.lookups', 'WorkerOrGroupLookup'),
246
    'all-worker-or-group' : ('calebasse.ressources.lookups', 'AllWorkerOrGroupLookup'),
247
}
248

    
249
# South configuration
250
SOUTH_TESTS_MIGRATE = False
251

    
252
# Default URL after login
253
LOGIN_REDIRECT_URL = '/'
254

    
255
# Sentry / raven configuration
256
# You need to overload this option in the local_settings.py
257
RAVEN_CONFIG = None
258

    
259
# Base directory for generated patient files
260
PATIENT_FILES_BASE_DIRECTORY = None
261

    
262
# Client side base directory for generated patient files
263
CLIENT_SIDE_PATIENT_FILES_BASE_DIRECTORY =  None
264

    
265
# Patient subdirectories
266
PATIENT_SUBDIRECTORIES = (
267
    u'Assistante sociale',
268
    u'Consultation',
269
    u'Courriers',
270
    u'Demande',
271
    u'Demandes prises en charge',
272
    u'Educateur spécialisé',
273
    u'Ergothérapie',
274
    u'Groupe',
275
    u'Kinésithérapie',
276
    u'Logico-mathématiques',
277
    u'Neuro-psychologie',
278
    u'Orientation',
279
    u'Orthophonie',
280
    u'Psychologie',
281
    u'Psychomotricité',
282
    u'Psychopédagogue',
283
    u'Synthèses',
284
    u'TCC',
285
)
286

    
287
# RTF templates directory
288
RTF_TEMPLATES_DIRECTORY = None
289
# Use patient home dictrory for RTF files generated
290
# PATIENT_FILES_BASE_DIRECTORY must be set to work
291
USE_PATIENT_FILE_RTF_REPOSITORY_DIRECTORY = False
292
# RTF files generated directory
293
RTF_REPOSITORY_DIRECTORY = None
294

    
295
# Invoicing file saving directory
296
INVOICING_DIRECTORY = None
297

    
298
# display events only for current service
299
CURRENT_SERVICE_EVENTS_ONLY = True
300

    
301
# dictionary to define non-default behaviours for some services
302
SERVICE_SETTINGS = {}
303
# valid keys
304
# - show_overlapping_appointments: boolean (default: False)
305
# - age_format: string, string (default: None, alternative behaviour to have
306
#   age always displayed in months: "months_only")
307

    
308

    
309
#CSV_ENCODING = 'cp1252' #For windows : windows-1252/Winlatin1
310
#CSVPROFILE = {\
311
#    'delimiter' : ';',
312
#    'quotechar' : '"',
313
#    'doublequote' : True
314
#    'skipinitialspace' : False
315
#    'lineterminator' : '\r\n'
316
#    'quoting' : csv.QUOTE_MINIMAL
317
#}
318

    
319
# IRIS/B2 transmission
320
# B2_TRANSMISSION = {
321
#    'output_directory': '/var/lib/calebasse/B2/',
322
#    # B2 informations
323
#    'nom': 'CMPP FOOBAR',                      # mandatory
324
#    'numero_emetteur': '123456789',            # mandatory
325
#    'norme': 'CP  ',
326
#    'type_emetteur': 'TE',
327
#    'application': 'TR',
328
#    'categorie': '189',
329
#    'statut': '60',
330
#    'mode_tarif': '05',
331
#    'message': 'ENTROUVERT 0143350135 CALEBASSE 1307',
332
#    # SMTP configuration
333
#    'smtp_from': 'transmission@domain.net',    # mandatory
334
#    'smtp_host': '127.0.0.1',
335
#    'smtp_port': 25,
336
#    'smtp_login': '',
337
#    'smtp_password': '',
338
#    # delay between two mails, in seconds, or None
339
#    'smtp_delay': None,
340
# }
341

    
342
try:
343
    from local_settings import *
344
except ImportError:
345
    print """
346
    -------------------------------------------------------------------------
347
    You need to create a local_settings.py file which needs to contain at least
348
    database connection information.
349

    
350
    Copy local_settings_example.py to local_settings.py and edit it.
351
    -------------------------------------------------------------------------
352
    """
353
    import sys
354
    sys.exit(1)
355

    
356
if RAVEN_CONFIG:
357
    INSTALLED_APPS += ('raven.contrib.django.raven_compat', )
358
    LOGGING['handlers']['sentry'] = {
359
            'level': 'ERROR',
360
            'class': 'raven.contrib.django.raven_compat.handlers.SentryHandler',
361
            }
362
    LOGGING['loggers']['raven'] = {
363
            'level': 'DEBUG',
364
            'handlers': ['console'],
365
            'propagate': False,
366
            }
367
    LOGGING['loggers']['sentry.errors'] = {
368
            'level': 'DEBUG',
369
            'handlers': ['console'],
370
            'propagate': False,
371
            }
372
    LOGGING['loggers']['']['handlers'].append('sentry')
(12-12/17)