1 # Django settings for xnet project.
7 ROOT_DIR
= os
.path
.abspath(os
.path
.dirname(os
.path
.dirname(__file__
)))
10 fname
= os
.path
.join(ROOT_DIR
, 'private', name
)
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
))
19 # ('Your Name', 'your_email@example.com'),
24 CONTACT_EMAIL
= 'contact@polytechnique.org'
26 AUTHENTICATION_BACKENDS
= (
27 'django_authgroupex.auth.AuthGroupeXBackend',
29 AUTHGROUPEX_KEY
= read_pass('authgroupex.key')
30 AUTHGROUPEX_FIELDS
= ('username', 'firstname', 'lastname', 'perms')
31 AUTHGROUPEX_SUPERADMIN_PERMS
= ('admin',)
32 AUTHGROUPEX_USER_MODEL
= 'accounts.Account'
33 LOGIN_URL
= '/xorgauth/'
34 LOGIN_REDIRECT_URL
= '/'
36 AUTH_USER_MODEL
= 'accounts.Account'
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.
42 TIME_ZONE
= 'Europe/Paris'
44 # Language code for this installation. All choices can be found here:
45 # http://www.i18nguy.com/unicode/language-identifiers.html
46 LANGUAGE_CODE
= 'en-us'
48 os
.path
.join(ROOT_DIR
, 'locale'),
51 TEMPLATE_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',
59 'xnet.site.context_processors.public_settings',
60 'xnet.groups.context_processors.xnet',
65 # If you set this to False, Django will make some optimizations so as not
66 # to load the internationalization machinery.
69 # If you set this to False, Django will not format dates, numbers and
70 # calendars according to the current locale.
73 # If you set this to False, Django will not use timezone-aware datetimes.
76 # Absolute filesystem path to the directory that will hold user-uploaded files.
77 # Example: "/home/media/media.lawrence.com/media/"
78 MEDIA_ROOT
= os
.path
.join(ROOT_DIR
, 'media')
80 # URL that handles the media served from MEDIA_ROOT. Make sure to use a
82 # Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
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/"
91 # URL prefix for static files.
92 # Example: "http://media.lawrence.com/static/"
93 STATIC_URL
= '/static/'
95 # Additional locations of static files
97 # os.path.join(ROOT_DIR, 'static'),
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.
103 # List of finder classes that know how to find static files in
105 STATICFILES_FINDERS
= (
106 # 'django.contrib.staticfiles.finders.FileSystemFinder',
107 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
108 # 'django.contrib.staticfiles.finders.DefaultStorageFinder',
111 # Make this unique, and don't share it with anybody.
112 SECRET_KEY
= 'FOR DEV ONLY!!'
114 # List of callables that know how to import templates from various sources.
116 # 'django.template.loaders.filesystem.Loader',
117 'django.template.loaders.app_directories.Loader',
118 # 'django.template.loaders.eggs.Loader',
121 MIDDLEWARE_CLASSES
= (
122 'django.middleware.common.CommonMiddleware',
123 'django.contrib.sessions.middleware.SessionMiddleware',
124 'django.middleware.csrf.CsrfViewMiddleware',
125 'django.contrib.auth.middleware.AuthenticationMiddleware',
126 'xnet.groups.middleware.XnetAccountMiddleware',
127 'django.contrib.messages.middleware.MessageMiddleware',
128 # Uncomment the next line for simple clickjacking protection:
129 # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
132 ROOT_URLCONF
= 'xnet.urls'
134 # Python dotted path to the WSGI application used by Django's runserver.
135 WSGI_APPLICATION
= 'xnet.wsgi.application'
138 #os.path.join(ROOT_DIR, 'templates'),
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.
145 # site app defines registration/ templates which overwrite other apps
148 'django.contrib.auth',
149 'django.contrib.contenttypes',
150 'django.contrib.sessions',
151 'django.contrib.sites',
152 'django.contrib.messages',
153 'django.contrib.staticfiles',
154 'django.contrib.admin',
156 'django_authgroupex',
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.
173 'disable_existing_loggers': False,
175 'require_debug_false': {
176 '()': 'django.utils.log.RequireDebugFalse'
182 'filters': ['require_debug_false'],
183 'class': 'django.utils.log.AdminEmailHandler'
188 'handlers': ['mail_admins'],
195 CRISPY_TEMPLATE_PACK
= 'bootstrap'