Add contact email setting
[xnet] / xnet / settings / base.py
CommitLineData
33234b2f
RB
1# Django settings for xnet project.
2
3DEBUG = True
4TEMPLATE_DEBUG = DEBUG
5
6import os.path
687bfc77 7ROOT_DIR = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
33234b2f
RB
8
9def read_pass(name):
10 fname = os.path.join(ROOT_DIR, 'private', name)
08ea8913
RB
11 try:
12 with open(fname, 'r') as f:
13 return f.readline().strip()
14 except (OSError, IOError) as e:
15 print("Unable to read %s: %s" % (fname, e))
16 return ''
33234b2f
RB
17
18ADMINS = (
19 # ('Your Name', 'your_email@example.com'),
20)
21
22MANAGERS = ADMINS
23
c078ccc6
NI
24CONTACT_EMAIL = 'contact@polytechnique.org'
25
33234b2f
RB
26AUTHENTICATION_BACKENDS = (
27 'django_authgroupex.auth.AuthGroupeXBackend',
28)
29AUTHGROUPEX_KEY = read_pass('authgroupex.key')
30AUTHGROUPEX_FIELDS = ('username', 'firstname', 'lastname', 'perms')
31AUTHGROUPEX_SUPERADMIN_PERMS = ('admin',)
53722fb0 32AUTHGROUPEX_USER_MODEL = 'accounts.Account'
33234b2f
RB
33LOGIN_URL = '/xorgauth/'
34LOGIN_REDIRECT_URL = '/'
35
53722fb0
BG
36AUTH_USER_MODEL = 'accounts.Account'
37
33234b2f
RB
38# Local time zone for this installation. Choices can be found here:
39# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
40# although not all choices may be available on all operating systems.
41# In a Windows environment this must be set to your system time zone.
42TIME_ZONE = 'Europe/Paris'
43
44# Language code for this installation. All choices can be found here:
45# http://www.i18nguy.com/unicode/language-identifiers.html
46LANGUAGE_CODE = 'en-us'
74a237a6
RB
47OCALE_PATHS = (
48 os.path.join(ROOT_DIR, 'locale'),
49)
50
97a0ca06
RB
51TEMPLATE_CONTEXT_PROCESSORS = (
52 'django.contrib.auth.context_processors.auth',
53 'django.core.context_processors.debug',
54 'django.core.context_processors.i18n',
55 'django.core.context_processors.media',
56 'django.core.context_processors.static',
57 'django.core.context_processors.tz',
58 'django.contrib.messages.context_processors.messages',
c078ccc6 59 'xnet.site.context_processors.public_settings',
95fa5c13 60 'xnet.groups.context_processors.xnet',
97a0ca06 61)
33234b2f
RB
62
63SITE_ID = 1
64
65# If you set this to False, Django will make some optimizations so as not
66# to load the internationalization machinery.
67USE_I18N = True
68
69# If you set this to False, Django will not format dates, numbers and
70# calendars according to the current locale.
71USE_L10N = True
72
73# If you set this to False, Django will not use timezone-aware datetimes.
74USE_TZ = True
75
76# Absolute filesystem path to the directory that will hold user-uploaded files.
77# Example: "/home/media/media.lawrence.com/media/"
626048e1 78MEDIA_ROOT = os.path.join(ROOT_DIR, 'media')
33234b2f
RB
79
80# URL that handles the media served from MEDIA_ROOT. Make sure to use a
81# trailing slash.
82# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
626048e1 83MEDIA_URL = '/media/'
33234b2f
RB
84
85# Absolute path to the directory static files should be collected to.
86# Don't put anything in this directory yourself; store your static files
87# in apps' "static/" subdirectories and in STATICFILES_DIRS.
88# Example: "/home/media/media.lawrence.com/static/"
89STATIC_ROOT = ''
90
91# URL prefix for static files.
92# Example: "http://media.lawrence.com/static/"
93STATIC_URL = '/static/'
94
95# Additional locations of static files
96STATICFILES_DIRS = (
7af930ab 97 # os.path.join(ROOT_DIR, 'static'),
33234b2f
RB
98 # Put strings here, like "/home/html/static" or "C:/www/django/static".
99 # Always use forward slashes, even on Windows.
100 # Don't forget to use absolute paths, not relative paths.
101)
102
103# List of finder classes that know how to find static files in
104# various locations.
105STATICFILES_FINDERS = (
eb2b4468 106# 'django.contrib.staticfiles.finders.FileSystemFinder',
33234b2f
RB
107 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
108# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
109)
110
111# Make this unique, and don't share it with anybody.
97a0ca06 112SECRET_KEY = 'FOR DEV ONLY!!'
33234b2f
RB
113
114# List of callables that know how to import templates from various sources.
115TEMPLATE_LOADERS = (
eb2b4468 116# 'django.template.loaders.filesystem.Loader',
33234b2f
RB
117 'django.template.loaders.app_directories.Loader',
118# 'django.template.loaders.eggs.Loader',
119)
120
121MIDDLEWARE_CLASSES = (
122 'django.middleware.common.CommonMiddleware',
123 'django.contrib.sessions.middleware.SessionMiddleware',
124 'django.middleware.csrf.CsrfViewMiddleware',
125 'django.contrib.auth.middleware.AuthenticationMiddleware',
95fa5c13 126 'xnet.groups.middleware.XnetAccountMiddleware',
33234b2f
RB
127 'django.contrib.messages.middleware.MessageMiddleware',
128 # Uncomment the next line for simple clickjacking protection:
129 # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
130)
131
132ROOT_URLCONF = 'xnet.urls'
133
134# Python dotted path to the WSGI application used by Django's runserver.
135WSGI_APPLICATION = 'xnet.wsgi.application'
136
137TEMPLATE_DIRS = (
eb2b4468 138 #os.path.join(ROOT_DIR, 'templates'),
33234b2f
RB
139 # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
140 # Always use forward slashes, even on Windows.
141 # Don't forget to use absolute paths, not relative paths.
142)
143
144INSTALLED_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 'django.contrib.admin',
152
153 'django_authgroupex',
93adc7d4 154 'crispy_forms',
95fa5c13 155
53722fb0 156 'xnet.accounts',
95fa5c13
RB
157 'xnet.site',
158 'xnet.groups',
2f062660 159 'xnet.news',
563bc08c 160 'xnet.events',
edcfa1b0 161 'xnet.profiles',
33234b2f
RB
162)
163
164# A sample logging configuration. The only tangible logging
165# performed by this configuration is to send an email to
166# the site admins on every HTTP 500 error when DEBUG=False.
167# See http://docs.djangoproject.com/en/dev/topics/logging for
168# more details on how to customize your logging configuration.
169LOGGING = {
170 'version': 1,
171 'disable_existing_loggers': False,
172 'filters': {
173 'require_debug_false': {
174 '()': 'django.utils.log.RequireDebugFalse'
175 }
176 },
177 'handlers': {
178 'mail_admins': {
179 'level': 'ERROR',
180 'filters': ['require_debug_false'],
181 'class': 'django.utils.log.AdminEmailHandler'
182 }
183 },
184 'loggers': {
185 'django.request': {
186 'handlers': ['mail_admins'],
187 'level': 'ERROR',
188 'propagate': True,
189 },
190 }
191}
93adc7d4
CW
192
193CRISPY_TEMPLATE_PACK = 'bootstrap'