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 AUTHENTICATION_BACKENDS
= (
25 'django_authgroupex.auth.AuthGroupeXBackend',
27 AUTHGROUPEX_KEY
= read_pass('authgroupex.key')
28 AUTHGROUPEX_FIELDS
= ('username', 'firstname', 'lastname', 'perms')
29 AUTHGROUPEX_SUPERADMIN_PERMS
= ('admin',)
30 AUTHGROUPEX_USER_MODEL
= 'accounts.Account'
31 LOGIN_URL
= '/xorgauth/'
32 LOGIN_REDIRECT_URL
= '/'
34 AUTH_USER_MODEL
= 'accounts.Account'
36 # Local time zone for this installation. Choices can be found here:
37 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
38 # although not all choices may be available on all operating systems.
39 # In a Windows environment this must be set to your system time zone.
40 TIME_ZONE
= 'Europe/Paris'
42 # Language code for this installation. All choices can be found here:
43 # http://www.i18nguy.com/unicode/language-identifiers.html
44 LANGUAGE_CODE
= 'en-us'
46 os
.path
.join(ROOT_DIR
, 'locale'),
49 TEMPLATE_CONTEXT_PROCESSORS
= (
50 'django.contrib.auth.context_processors.auth',
51 'django.core.context_processors.debug',
52 'django.core.context_processors.i18n',
53 'django.core.context_processors.media',
54 'django.core.context_processors.static',
55 'django.core.context_processors.tz',
56 'django.contrib.messages.context_processors.messages',
57 'xnet.groups.context_processors.xnet',
62 # If you set this to False, Django will make some optimizations so as not
63 # to load the internationalization machinery.
66 # If you set this to False, Django will not format dates, numbers and
67 # calendars according to the current locale.
70 # If you set this to False, Django will not use timezone-aware datetimes.
73 # Absolute filesystem path to the directory that will hold user-uploaded files.
74 # Example: "/home/media/media.lawrence.com/media/"
75 MEDIA_ROOT
= os
.path
.join(ROOT_DIR
, 'media')
77 # URL that handles the media served from MEDIA_ROOT. Make sure to use a
79 # Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
82 # Absolute path to the directory static files should be collected to.
83 # Don't put anything in this directory yourself; store your static files
84 # in apps' "static/" subdirectories and in STATICFILES_DIRS.
85 # Example: "/home/media/media.lawrence.com/static/"
88 # URL prefix for static files.
89 # Example: "http://media.lawrence.com/static/"
90 STATIC_URL
= '/static/'
92 # Additional locations of static files
94 # os.path.join(ROOT_DIR, 'static'),
95 # Put strings here, like "/home/html/static" or "C:/www/django/static".
96 # Always use forward slashes, even on Windows.
97 # Don't forget to use absolute paths, not relative paths.
100 # List of finder classes that know how to find static files in
102 STATICFILES_FINDERS
= (
103 'django.contrib.staticfiles.finders.FileSystemFinder',
104 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
105 # 'django.contrib.staticfiles.finders.DefaultStorageFinder',
108 # Make this unique, and don't share it with anybody.
109 SECRET_KEY
= 'FOR DEV ONLY!!'
111 # List of callables that know how to import templates from various sources.
113 'django.template.loaders.filesystem.Loader',
114 'django.template.loaders.app_directories.Loader',
115 # 'django.template.loaders.eggs.Loader',
118 MIDDLEWARE_CLASSES
= (
119 'django.middleware.common.CommonMiddleware',
120 'django.contrib.sessions.middleware.SessionMiddleware',
121 'django.middleware.csrf.CsrfViewMiddleware',
122 'django.contrib.auth.middleware.AuthenticationMiddleware',
123 'xnet.groups.middleware.XnetAccountMiddleware',
124 'django.contrib.messages.middleware.MessageMiddleware',
125 # Uncomment the next line for simple clickjacking protection:
126 # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
129 ROOT_URLCONF
= 'xnet.urls'
131 # Python dotted path to the WSGI application used by Django's runserver.
132 WSGI_APPLICATION
= 'xnet.wsgi.application'
135 os
.path
.join(ROOT_DIR
, 'templates'),
136 # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
137 # Always use forward slashes, even on Windows.
138 # Don't forget to use absolute paths, not relative paths.
142 'django.contrib.auth',
143 'django.contrib.contenttypes',
144 'django.contrib.sessions',
145 'django.contrib.sites',
146 'django.contrib.messages',
147 'django.contrib.staticfiles',
148 'django.contrib.admin',
150 'django_authgroupex',
161 # A sample logging configuration. The only tangible logging
162 # performed by this configuration is to send an email to
163 # the site admins on every HTTP 500 error when DEBUG=False.
164 # See http://docs.djangoproject.com/en/dev/topics/logging for
165 # more details on how to customize your logging configuration.
168 'disable_existing_loggers': False,
170 'require_debug_false': {
171 '()': 'django.utils.log.RequireDebugFalse'
177 'filters': ['require_debug_false'],
178 'class': 'django.utils.log.AdminEmailHandler'
183 'handlers': ['mail_admins'],
190 CRISPY_TEMPLATE_PACK
= 'bootstrap'