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