1
|
# Django settings for wcsinst project.
|
2
|
|
3
|
import os
|
4
|
|
5
|
DEBUG = 'DEBUG' in os.environ
|
6
|
TEMPLATE_DEBUG = DEBUG
|
7
|
|
8
|
PROJECT_PATH = os.path.dirname(os.path.dirname(__file__))
|
9
|
|
10
|
ADMINS = (
|
11
|
# ('Your Name', 'your_email@example.com'),
|
12
|
)
|
13
|
|
14
|
if 'ADMINS' in os.environ:
|
15
|
ADMINS = filter(None, os.environ.get('ADMINS').split(':'))
|
16
|
ADMINS = [ admin.split(';') for admin in ADMINS ]
|
17
|
for admin in ADMINS:
|
18
|
assert len(admin) == 2, 'ADMINS setting must be a colon separated list of name and emails separated by a semi-colon'
|
19
|
assert '@' in admin[1], 'ADMINS setting pairs second value must be emails'
|
20
|
|
21
|
MANAGERS = ADMINS
|
22
|
|
23
|
DATABASES = {
|
24
|
'default': {
|
25
|
'ENGINE': 'django.db.backends.sqlite3',
|
26
|
'NAME': os.path.join(PROJECT_PATH, 'wcsinst.sqlite3'),
|
27
|
}
|
28
|
}
|
29
|
|
30
|
# Hosts/domain names that are valid for this site; required if DEBUG is False
|
31
|
# See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
|
32
|
ALLOWED_HOSTS = []
|
33
|
|
34
|
# Local time zone for this installation. Choices can be found here:
|
35
|
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
|
36
|
# although not all choices may be available on all operating systems.
|
37
|
# In a Windows environment this must be set to your system time zone.
|
38
|
TIME_ZONE = 'Europe/Brussels'
|
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
|
|
54
|
# If you set this to False, Django will not use timezone-aware datetimes.
|
55
|
USE_TZ = True
|
56
|
|
57
|
# Absolute filesystem path to the directory that will hold user-uploaded files.
|
58
|
# Example: "/var/www/example.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://example.com/media/", "http://media.example.com/"
|
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: "/var/www/example.com/static/"
|
70
|
STATIC_ROOT = os.path.join(PROJECT_PATH, 'static')
|
71
|
|
72
|
# URL prefix for static files.
|
73
|
# Example: "http://example.com/static/", "http://static.example.com/"
|
74
|
STATIC_URL = '/static/'
|
75
|
|
76
|
# Additional locations of static files
|
77
|
STATICFILES_DIRS = (
|
78
|
)
|
79
|
|
80
|
# List of finder classes that know how to find static files in
|
81
|
# various locations.
|
82
|
STATICFILES_FINDERS = (
|
83
|
'django.contrib.staticfiles.finders.FileSystemFinder',
|
84
|
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
85
|
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
|
86
|
)
|
87
|
|
88
|
# Make this unique, and don't share it with anybody.
|
89
|
SECRET_KEY = 'sw-v(^psaet3)44flti-zr!=u64mzfeaodkey(m=&^nz(=43!o'
|
90
|
|
91
|
# List of callables that know how to import templates from various sources.
|
92
|
TEMPLATE_LOADERS = (
|
93
|
'django.template.loaders.filesystem.Loader',
|
94
|
'django.template.loaders.app_directories.Loader',
|
95
|
# 'django.template.loaders.eggs.Loader',
|
96
|
)
|
97
|
|
98
|
MIDDLEWARE_CLASSES = (
|
99
|
'django.middleware.common.CommonMiddleware',
|
100
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
101
|
'django.middleware.csrf.CsrfViewMiddleware',
|
102
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
103
|
'django.contrib.messages.middleware.MessageMiddleware',
|
104
|
# Uncomment the next line for simple clickjacking protection:
|
105
|
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
106
|
)
|
107
|
|
108
|
ROOT_URLCONF = 'wcsinst.urls'
|
109
|
|
110
|
# Python dotted path to the WSGI application used by Django's runserver.
|
111
|
WSGI_APPLICATION = 'wcsinst.wsgi.application'
|
112
|
|
113
|
TEMPLATE_DIRS = (
|
114
|
os.path.join(PROJECT_PATH, 'wcsinst', 'templates'),
|
115
|
)
|
116
|
|
117
|
INSTALLED_APPS = (
|
118
|
'south',
|
119
|
'django.contrib.auth',
|
120
|
'django.contrib.contenttypes',
|
121
|
'django.contrib.sessions',
|
122
|
'django.contrib.sites',
|
123
|
'django.contrib.messages',
|
124
|
'django.contrib.staticfiles',
|
125
|
'django.contrib.admin',
|
126
|
)
|
127
|
|
128
|
# A sample logging configuration. The only tangible logging
|
129
|
# performed by this configuration is to send an email to
|
130
|
# the site admins on every HTTP 500 error when DEBUG=False.
|
131
|
# See http://docs.djangoproject.com/en/dev/topics/logging for
|
132
|
# more details on how to customize your logging configuration.
|
133
|
LOGGING = {
|
134
|
'version': 1,
|
135
|
'disable_existing_loggers': False,
|
136
|
'filters': {
|
137
|
'require_debug_false': {
|
138
|
'()': 'django.utils.log.RequireDebugFalse'
|
139
|
}
|
140
|
},
|
141
|
'handlers': {
|
142
|
'mail_admins': {
|
143
|
'level': 'ERROR',
|
144
|
'filters': ['require_debug_false'],
|
145
|
'class': 'django.utils.log.AdminEmailHandler'
|
146
|
}
|
147
|
},
|
148
|
'loggers': {
|
149
|
'django.request': {
|
150
|
'handlers': ['mail_admins'],
|
151
|
'level': 'ERROR',
|
152
|
'propagate': True,
|
153
|
},
|
154
|
}
|
155
|
}
|
156
|
|
157
|
WCSINSTD_URL = os.environ.get('WCSINSTD_URL')
|
158
|
|
159
|
if WCSINSTD_URL:
|
160
|
INSTALLED_APPS += ('wcsinst.wcsinst',)
|
161
|
else:
|
162
|
INSTALLED_APPS += ('wcsinst.wcsinstd',)
|
163
|
|
164
|
WCSINST_WCSCTL_SCRIPT = os.environ.get('WCSINST_WCSCTL_SCRIPT', 'wcsctl')
|
165
|
|
166
|
if 'SENTRY_DSN' in os.environ:
|
167
|
INSTALLED_APPS += ('raven.contrib.django.raven_compat',)
|
168
|
RAVEN_CONFIG = os.environ.get('SENTRY_DSN')
|
169
|
|
170
|
try:
|
171
|
from local_settings import *
|
172
|
except ImportError:
|
173
|
pass
|