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) | |
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 | |
18 | ADMINS = ( | |
19 | # ('Your Name', 'your_email@example.com'), | |
20 | ) | |
21 | ||
22 | MANAGERS = ADMINS | |
23 | ||
33234b2f RB |
24 | AUTHENTICATION_BACKENDS = ( |
25 | 'django_authgroupex.auth.AuthGroupeXBackend', | |
26 | ) | |
27 | AUTHGROUPEX_KEY = read_pass('authgroupex.key') | |
28 | AUTHGROUPEX_FIELDS = ('username', 'firstname', 'lastname', 'perms') | |
29 | AUTHGROUPEX_SUPERADMIN_PERMS = ('admin',) | |
53722fb0 | 30 | AUTHGROUPEX_USER_MODEL = 'accounts.Account' |
33234b2f RB |
31 | LOGIN_URL = '/xorgauth/' |
32 | LOGIN_REDIRECT_URL = '/' | |
33 | ||
53722fb0 BG |
34 | AUTH_USER_MODEL = 'accounts.Account' |
35 | ||
33234b2f RB |
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' | |
41 | ||
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' | |
74a237a6 RB |
45 | OCALE_PATHS = ( |
46 | os.path.join(ROOT_DIR, 'locale'), | |
47 | ) | |
48 | ||
97a0ca06 RB |
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', | |
95fa5c13 | 57 | 'xnet.groups.context_processors.xnet', |
97a0ca06 | 58 | ) |
33234b2f RB |
59 | |
60 | SITE_ID = 1 | |
61 | ||
62 | # If you set this to False, Django will make some optimizations so as not | |
63 | # to load the internationalization machinery. | |
64 | USE_I18N = True | |
65 | ||
66 | # If you set this to False, Django will not format dates, numbers and | |
67 | # calendars according to the current locale. | |
68 | USE_L10N = True | |
69 | ||
70 | # If you set this to False, Django will not use timezone-aware datetimes. | |
71 | USE_TZ = True | |
72 | ||
73 | # Absolute filesystem path to the directory that will hold user-uploaded files. | |
74 | # Example: "/home/media/media.lawrence.com/media/" | |
626048e1 | 75 | MEDIA_ROOT = os.path.join(ROOT_DIR, 'media') |
33234b2f RB |
76 | |
77 | # URL that handles the media served from MEDIA_ROOT. Make sure to use a | |
78 | # trailing slash. | |
79 | # Examples: "http://media.lawrence.com/media/", "http://example.com/media/" | |
626048e1 | 80 | MEDIA_URL = '/media/' |
33234b2f RB |
81 | |
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/" | |
86 | STATIC_ROOT = '' | |
87 | ||
88 | # URL prefix for static files. | |
89 | # Example: "http://media.lawrence.com/static/" | |
90 | STATIC_URL = '/static/' | |
91 | ||
92 | # Additional locations of static files | |
93 | STATICFILES_DIRS = ( | |
7af930ab | 94 | # os.path.join(ROOT_DIR, 'static'), |
33234b2f RB |
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. | |
98 | ) | |
99 | ||
100 | # List of finder classes that know how to find static files in | |
101 | # various locations. | |
102 | STATICFILES_FINDERS = ( | |
103 | 'django.contrib.staticfiles.finders.FileSystemFinder', | |
104 | 'django.contrib.staticfiles.finders.AppDirectoriesFinder', | |
105 | # 'django.contrib.staticfiles.finders.DefaultStorageFinder', | |
106 | ) | |
107 | ||
108 | # Make this unique, and don't share it with anybody. | |
97a0ca06 | 109 | SECRET_KEY = 'FOR DEV ONLY!!' |
33234b2f RB |
110 | |
111 | # List of callables that know how to import templates from various sources. | |
112 | TEMPLATE_LOADERS = ( | |
113 | 'django.template.loaders.filesystem.Loader', | |
114 | 'django.template.loaders.app_directories.Loader', | |
115 | # 'django.template.loaders.eggs.Loader', | |
116 | ) | |
117 | ||
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', | |
95fa5c13 | 123 | 'xnet.groups.middleware.XnetAccountMiddleware', |
33234b2f RB |
124 | 'django.contrib.messages.middleware.MessageMiddleware', |
125 | # Uncomment the next line for simple clickjacking protection: | |
126 | # 'django.middleware.clickjacking.XFrameOptionsMiddleware', | |
127 | ) | |
128 | ||
129 | ROOT_URLCONF = 'xnet.urls' | |
130 | ||
131 | # Python dotted path to the WSGI application used by Django's runserver. | |
132 | WSGI_APPLICATION = 'xnet.wsgi.application' | |
133 | ||
134 | TEMPLATE_DIRS = ( | |
ccb456d7 | 135 | os.path.join(ROOT_DIR, 'templates'), |
33234b2f RB |
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. | |
139 | ) | |
140 | ||
141 | INSTALLED_APPS = ( | |
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', | |
149 | ||
150 | 'django_authgroupex', | |
93adc7d4 | 151 | 'crispy_forms', |
95fa5c13 | 152 | |
53722fb0 | 153 | 'xnet.accounts', |
95fa5c13 RB |
154 | 'xnet.site', |
155 | 'xnet.groups', | |
2f062660 | 156 | 'xnet.news', |
563bc08c | 157 | 'xnet.events', |
33234b2f RB |
158 | 'xnet.example', |
159 | ) | |
160 | ||
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. | |
166 | LOGGING = { | |
167 | 'version': 1, | |
168 | 'disable_existing_loggers': False, | |
169 | 'filters': { | |
170 | 'require_debug_false': { | |
171 | '()': 'django.utils.log.RequireDebugFalse' | |
172 | } | |
173 | }, | |
174 | 'handlers': { | |
175 | 'mail_admins': { | |
176 | 'level': 'ERROR', | |
177 | 'filters': ['require_debug_false'], | |
178 | 'class': 'django.utils.log.AdminEmailHandler' | |
179 | } | |
180 | }, | |
181 | 'loggers': { | |
182 | 'django.request': { | |
183 | 'handlers': ['mail_admins'], | |
184 | 'level': 'ERROR', | |
185 | 'propagate': True, | |
186 | }, | |
187 | } | |
188 | } | |
93adc7d4 CW |
189 | |
190 | CRISPY_TEMPLATE_PACK = 'bootstrap' |