Commit | Line | Data |
---|---|---|
33234b2f RB |
1 | # Django settings for xnet project. |
2 | ||
3 | DEBUG = True | |
4 | TEMPLATE_DEBUG = DEBUG | |
5 | ||
6 | import os.path | |
687bfc77 | 7 | ROOT_DIR = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) |
33234b2f RB |
8 | |
9 | def 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 | ||
14 | ADMINS = ( | |
15 | # ('Your Name', 'your_email@example.com'), | |
16 | ) | |
17 | ||
18 | MANAGERS = ADMINS | |
19 | ||
33234b2f RB |
20 | AUTHENTICATION_BACKENDS = ( |
21 | 'django_authgroupex.auth.AuthGroupeXBackend', | |
22 | ) | |
23 | AUTHGROUPEX_KEY = read_pass('authgroupex.key') | |
24 | AUTHGROUPEX_FIELDS = ('username', 'firstname', 'lastname', 'perms') | |
25 | AUTHGROUPEX_SUPERADMIN_PERMS = ('admin',) | |
53722fb0 | 26 | AUTHGROUPEX_USER_MODEL = 'accounts.Account' |
33234b2f RB |
27 | LOGIN_URL = '/xorgauth/' |
28 | LOGIN_REDIRECT_URL = '/' | |
29 | ||
53722fb0 BG |
30 | AUTH_USER_MODEL = 'accounts.Account' |
31 | ||
33234b2f RB |
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. | |
36 | TIME_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 | |
40 | LANGUAGE_CODE = 'en-us' | |
74a237a6 RB |
41 | OCALE_PATHS = ( |
42 | os.path.join(ROOT_DIR, 'locale'), | |
43 | ) | |
44 | ||
97a0ca06 RB |
45 | TEMPLATE_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 | ) | |
33234b2f RB |
55 | |
56 | SITE_ID = 1 | |
57 | ||
58 | # If you set this to False, Django will make some optimizations so as not | |
59 | # to load the internationalization machinery. | |
60 | USE_I18N = True | |
61 | ||
62 | # If you set this to False, Django will not format dates, numbers and | |
63 | # calendars according to the current locale. | |
64 | USE_L10N = True | |
65 | ||
66 | # If you set this to False, Django will not use timezone-aware datetimes. | |
67 | USE_TZ = True | |
68 | ||
69 | # Absolute filesystem path to the directory that will hold user-uploaded files. | |
70 | # Example: "/home/media/media.lawrence.com/media/" | |
626048e1 | 71 | MEDIA_ROOT = os.path.join(ROOT_DIR, 'media') |
33234b2f RB |
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/" | |
626048e1 | 76 | MEDIA_URL = '/media/' |
33234b2f RB |
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/" | |
82 | STATIC_ROOT = '' | |
83 | ||
84 | # URL prefix for static files. | |
85 | # Example: "http://media.lawrence.com/static/" | |
86 | STATIC_URL = '/static/' | |
87 | ||
88 | # Additional locations of static files | |
89 | STATICFILES_DIRS = ( | |
66ae88f4 | 90 | os.path.join(ROOT_DIR, 'static'), |
33234b2f RB |
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. | |
98 | STATICFILES_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. | |
97a0ca06 | 105 | SECRET_KEY = 'FOR DEV ONLY!!' |
33234b2f RB |
106 | |
107 | # List of callables that know how to import templates from various sources. | |
108 | TEMPLATE_LOADERS = ( | |
109 | 'django.template.loaders.filesystem.Loader', | |
110 | 'django.template.loaders.app_directories.Loader', | |
111 | # 'django.template.loaders.eggs.Loader', | |
112 | ) | |
113 | ||
114 | MIDDLEWARE_CLASSES = ( | |
115 | 'django.middleware.common.CommonMiddleware', | |
116 | 'django.contrib.sessions.middleware.SessionMiddleware', | |
117 | 'django.middleware.csrf.CsrfViewMiddleware', | |
118 | 'django.contrib.auth.middleware.AuthenticationMiddleware', | |
97a0ca06 | 119 | 'xnet.accounts.middleware.XnetAccountMiddleware', |
33234b2f RB |
120 | 'django.contrib.messages.middleware.MessageMiddleware', |
121 | # Uncomment the next line for simple clickjacking protection: | |
122 | # 'django.middleware.clickjacking.XFrameOptionsMiddleware', | |
123 | ) | |
124 | ||
125 | ROOT_URLCONF = 'xnet.urls' | |
126 | ||
127 | # Python dotted path to the WSGI application used by Django's runserver. | |
128 | WSGI_APPLICATION = 'xnet.wsgi.application' | |
129 | ||
130 | TEMPLATE_DIRS = ( | |
ccb456d7 | 131 | os.path.join(ROOT_DIR, 'templates'), |
33234b2f RB |
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 | ||
137 | INSTALLED_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', | |
93adc7d4 | 147 | 'crispy_forms', |
33234b2f | 148 | 'xnet.site', |
53722fb0 | 149 | 'xnet.accounts', |
2f062660 | 150 | 'xnet.news', |
563bc08c | 151 | 'xnet.events', |
33234b2f RB |
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. | |
160 | LOGGING = { | |
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 | } | |
93adc7d4 CW |
183 | |
184 | CRISPY_TEMPLATE_PACK = 'bootstrap' |