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