Project

General

Profile

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

calebasse / calebasse / settings / common.py @ db074db2

1
# Django settings for calebasse project.
2

    
3
import os
4
from logging.handlers import SysLogHandler
5

    
6
from ..settings import PROJECT_PATH
7

    
8
DEBUG = True
9
TEMPLATE_DEBUG = True
10

    
11
ADMINS = (
12
    # ('Your Name', 'your_email@example.com'),
13
)
14

    
15
MANAGERS = ADMINS
16

    
17
DATABASES = {
18
    'default': {
19
        'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
20
        'NAME': os.path.join(PROJECT_PATH, 'calebasse.sqlite3'),                      # Or path to database file if using sqlite3.
21
        'USER': '',                      # Not used with sqlite3.
22
        'PASSWORD': '',                  # Not used with sqlite3.
23
        'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
24
        'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
25
    }
26
}
27

    
28
# Local time zone for this installation. Choices can be found here:
29
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
30
# although not all choices may be available on all operating systems.
31
# On Unix systems, a value of None will cause Django to use the same
32
# timezone as the operating system.
33
# If running in a Windows environment this must be set to the same as your
34
# system time zone.
35
TIME_ZONE = 'Europe/Paris'
36

    
37
# Language code for this installation. All choices can be found here:
38
# http://www.i18nguy.com/unicode/language-identifiers.html
39
LANGUAGE_CODE = 'fr-fr'
40

    
41
SITE_ID = 1
42

    
43
# If you set this to False, Django will make some optimizations so as not
44
# to load the internationalization machinery.
45
USE_I18N = True
46

    
47
# If you set this to False, Django will not format dates, numbers and
48
# calendars according to the current locale.
49
USE_L10N = True
50
FORMAT_MODULE_PATH = 'calebasse.settings.formats'
51

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

    
55
# Absolute filesystem path to the directory that will hold user-uploaded files.
56
# Example: "/home/media/media.lawrence.com/media/"
57
MEDIA_ROOT = os.path.join(PROJECT_PATH, 'media')
58

    
59
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
60
# trailing slash.
61
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
62
MEDIA_URL = '/media/'
63

    
64
# Absolute path to the directory static files should be collected to.
65
# Don't put anything in this directory yourself; store your static files
66
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
67
# Example: "/home/media/media.lawrence.com/static/"
68
STATIC_ROOT = os.path.join(os.path.join(PROJECT_PATH, '..'), 'static')
69

    
70
# URL prefix for static files.
71
# Example: "http://media.lawrence.com/static/"
72
STATIC_URL = '/static/'
73

    
74
# Additional locations of static files
75
STATICFILES_DIRS = (
76
    # Put strings here, like "/home/html/static" or "C:/www/django/static".
77
    # Always use forward slashes, even on Windows.
78
    # Don't forget to use absolute paths, not relative paths.
79
    os.path.join(PROJECT_PATH, 'static'),
80
)
81

    
82
# List of finder classes that know how to find static files in
83
# various locations.
84
STATICFILES_FINDERS = (
85
    'django.contrib.staticfiles.finders.FileSystemFinder',
86
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
87
#    'django.contrib.staticfiles.finders.DefaultStorageFinder',
88
)
89

    
90
# Make this unique, and don't share it with anybody.
91
SECRET_KEY = 'ct(a@ny^_)8v-^)jkdzbktqg6ajfn6y!zdjum^(f_o!h0jeotq'
92

    
93
# List of callables that know how to import templates from various sources.
94
TEMPLATE_LOADERS = (
95
    'django.template.loaders.filesystem.Loader',
96
    'django.template.loaders.app_directories.Loader',
97
#     'django.template.loaders.eggs.Loader',
98
)
99

    
100
MIDDLEWARE_CLASSES = (
101
    'django.middleware.common.CommonMiddleware',
102
    'django.contrib.sessions.middleware.SessionMiddleware',
103
    'django.middleware.csrf.CsrfViewMiddleware',
104
    'django.contrib.auth.middleware.AuthenticationMiddleware',
105
    'django.contrib.messages.middleware.MessageMiddleware',
106
    'debug_toolbar.middleware.DebugToolbarMiddleware',
107
    'calebasse.middleware.request.GlobalRequestMiddleware',
108
    # Uncomment the next line for simple clickjacking protection:
109
    # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
110
)
111

    
112
ROOT_URLCONF = 'calebasse.urls'
113

    
114
# Python dotted path to the WSGI application used by Django's runserver.
115
WSGI_APPLICATION = 'calebasse.wsgi.application'
116

    
117
TEMPLATE_DIRS = (
118
    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
119
    # Always use forward slashes, even on Windows.
120
    # Don't forget to use absolute paths, not relative paths.
121
    os.path.join(PROJECT_PATH, "templates")
122
)
123

    
124
TEMPLATE_CONTEXT_PROCESSORS = ("django.contrib.auth.context_processors.auth",
125
    "django.core.context_processors.debug",
126
    "django.core.context_processors.i18n",
127
    "django.core.context_processors.media",
128
    "django.core.context_processors.static",
129
    "django.core.context_processors.tz",
130
    "django.core.context_processors.request",
131
    "django.contrib.messages.context_processors.messages")
132

    
133
FIXTURE_DIRS = (
134
        os.path.join(PROJECT_PATH, 'fixtures'),
135
)
136

    
137
INSTALLED_APPS = (
138
    'django.contrib.auth',
139
    'django.contrib.contenttypes',
140
    'django.contrib.sessions',
141
    'django.contrib.sites',
142
    'django.contrib.messages',
143
    'django.contrib.staticfiles',
144
    'reversion',
145
    'south',
146
    'django.contrib.admin',
147
    'ajax_select',
148
    'debug_toolbar',
149
    'widget_tweaks',
150
    # Uncomment the next line to enable admin documentation:
151
    # 'django.contrib.admindocs',
152
    'calebasse.agenda',
153
    'calebasse.dossiers',
154
    'calebasse.actes',
155
    'calebasse.facturation',
156
    'calebasse.personnes',
157
    'calebasse.ressources',
158
    'calebasse.middleware.request',
159
)
160

    
161
INTERNAL_IPS=('127.0.0.1',)
162
DEBUG_TOOLBAR_CONFIG = {
163
    'INTERCEPT_REDIRECTS': False,
164
}
165

    
166
# A sample logging configuration. The only tangible logging
167
# performed by this configuration is to send an email to
168
# the site admins on every HTTP 500 error when DEBUG=False.
169
# See http://docs.djangoproject.com/en/dev/topics/logging for
170
# more details on how to customize your logging configuration.
171
LOGGING = {
172
    'version': 1,
173
    'disable_existing_loggers': False,
174
    'filters': {
175
        'require_debug_false': {
176
            '()': 'django.utils.log.RequireDebugFalse'
177
        },
178
    },
179
    'formatters': {
180
        'verbose': {
181
            'format': '[%(asctime)s] %(levelname)-8s %(name)s.%(message)s',
182
            'datefmt': '%Y-%m-%d %a %H:%M:%S'
183
        },
184
    },
185
    'handlers': {
186
        'mail_admins': {
187
            'level': 'ERROR',
188
            'filters': ['require_debug_false'],
189
            'class': 'django.utils.log.AdminEmailHandler'
190
        },
191
        'console': {
192
            'level':'INFO',
193
            'class':'logging.StreamHandler',
194
            'formatter': 'verbose',
195
        },
196
        'local_file': {
197
            'level':'DEBUG',
198
            'class':'logging.FileHandler',
199
            'formatter': 'verbose',
200
            'filename': os.path.join(PROJECT_PATH, 'calebasse.log'),
201
        },
202
        'syslog':{
203
            'level':'INFO',
204
            'class':'logging.handlers.SysLogHandler',
205
            'facility': SysLogHandler.LOG_LOCAL0,
206
            'address': '/dev/log',
207
        },
208
    },
209
    'loggers': {
210
        '': {
211
            'handlers': ['mail_admins','syslog'],
212
            'level': 'INFO',
213
        },
214
    },
215
    'root': {
216
            'handlers': ['console', 'local_file'],
217
            'level': 'DEBUG',
218
    }
219
}
220

    
221
# AJAX Select
222
AJAX_LOOKUP_CHANNELS = {
223
    #   pass a dict with the model and the field to search against
224
    'worker'  : {'model':'personnes.Worker', 'search_field':'display_name'},
225
    'patientrecord'  : {'model':'dossiers.PatientRecord', 'search_field':'display_name'}
226
}
(3-3/4)