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',) | |
33 | LOGIN_URL = '/xorgauth/' | |
34 | LOGIN_REDIRECT_URL = '/' | |
35 | ||
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 | ||
33234b2f RB |
49 | |
50 | SITE_ID = 1 | |
51 | ||
52 | # If you set this to False, Django will make some optimizations so as not | |
53 | # to load the internationalization machinery. | |
54 | USE_I18N = True | |
55 | ||
56 | # If you set this to False, Django will not format dates, numbers and | |
57 | # calendars according to the current locale. | |
58 | USE_L10N = True | |
59 | ||
60 | # If you set this to False, Django will not use timezone-aware datetimes. | |
61 | USE_TZ = True | |
62 | ||
63 | # Absolute filesystem path to the directory that will hold user-uploaded files. | |
64 | # Example: "/home/media/media.lawrence.com/media/" | |
65 | MEDIA_ROOT = '' | |
66 | ||
67 | # URL that handles the media served from MEDIA_ROOT. Make sure to use a | |
68 | # trailing slash. | |
69 | # Examples: "http://media.lawrence.com/media/", "http://example.com/media/" | |
70 | MEDIA_URL = '' | |
71 | ||
72 | # Absolute path to the directory static files should be collected to. | |
73 | # Don't put anything in this directory yourself; store your static files | |
74 | # in apps' "static/" subdirectories and in STATICFILES_DIRS. | |
75 | # Example: "/home/media/media.lawrence.com/static/" | |
76 | STATIC_ROOT = '' | |
77 | ||
78 | # URL prefix for static files. | |
79 | # Example: "http://media.lawrence.com/static/" | |
80 | STATIC_URL = '/static/' | |
81 | ||
82 | # Additional locations of static files | |
83 | STATICFILES_DIRS = ( | |
84 | # Put strings here, like "/home/html/static" or "C:/www/django/static". | |
85 | # Always use forward slashes, even on Windows. | |
86 | # Don't forget to use absolute paths, not relative paths. | |
87 | ) | |
88 | ||
89 | # List of finder classes that know how to find static files in | |
90 | # various locations. | |
91 | STATICFILES_FINDERS = ( | |
92 | 'django.contrib.staticfiles.finders.FileSystemFinder', | |
93 | 'django.contrib.staticfiles.finders.AppDirectoriesFinder', | |
94 | # 'django.contrib.staticfiles.finders.DefaultStorageFinder', | |
95 | ) | |
96 | ||
97 | # Make this unique, and don't share it with anybody. | |
98 | SECRET_KEY = 'iq9w_94mr$p$a3sr%*cnvt8z($-)zjk1o8wx45dw(6z3%(mwzo' | |
99 | ||
100 | # List of callables that know how to import templates from various sources. | |
101 | TEMPLATE_LOADERS = ( | |
102 | 'django.template.loaders.filesystem.Loader', | |
103 | 'django.template.loaders.app_directories.Loader', | |
104 | # 'django.template.loaders.eggs.Loader', | |
105 | ) | |
106 | ||
107 | MIDDLEWARE_CLASSES = ( | |
108 | 'django.middleware.common.CommonMiddleware', | |
109 | 'django.contrib.sessions.middleware.SessionMiddleware', | |
110 | 'django.middleware.csrf.CsrfViewMiddleware', | |
111 | 'django.contrib.auth.middleware.AuthenticationMiddleware', | |
112 | 'django.contrib.messages.middleware.MessageMiddleware', | |
113 | # Uncomment the next line for simple clickjacking protection: | |
114 | # 'django.middleware.clickjacking.XFrameOptionsMiddleware', | |
115 | ) | |
116 | ||
117 | ROOT_URLCONF = 'xnet.urls' | |
118 | ||
119 | # Python dotted path to the WSGI application used by Django's runserver. | |
120 | WSGI_APPLICATION = 'xnet.wsgi.application' | |
121 | ||
122 | TEMPLATE_DIRS = ( | |
ccb456d7 | 123 | os.path.join(ROOT_DIR, 'templates'), |
33234b2f RB |
124 | # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". |
125 | # Always use forward slashes, even on Windows. | |
126 | # Don't forget to use absolute paths, not relative paths. | |
127 | ) | |
128 | ||
129 | INSTALLED_APPS = ( | |
130 | 'django.contrib.auth', | |
131 | 'django.contrib.contenttypes', | |
132 | 'django.contrib.sessions', | |
133 | 'django.contrib.sites', | |
134 | 'django.contrib.messages', | |
135 | 'django.contrib.staticfiles', | |
136 | 'django.contrib.admin', | |
137 | ||
138 | 'django_authgroupex', | |
139 | 'xnet.site', | |
74a237a6 | 140 | 'xnet.group', |
33234b2f RB |
141 | 'xnet.example', |
142 | ) | |
143 | ||
144 | # A sample logging configuration. The only tangible logging | |
145 | # performed by this configuration is to send an email to | |
146 | # the site admins on every HTTP 500 error when DEBUG=False. | |
147 | # See http://docs.djangoproject.com/en/dev/topics/logging for | |
148 | # more details on how to customize your logging configuration. | |
149 | LOGGING = { | |
150 | 'version': 1, | |
151 | 'disable_existing_loggers': False, | |
152 | 'filters': { | |
153 | 'require_debug_false': { | |
154 | '()': 'django.utils.log.RequireDebugFalse' | |
155 | } | |
156 | }, | |
157 | 'handlers': { | |
158 | 'mail_admins': { | |
159 | 'level': 'ERROR', | |
160 | 'filters': ['require_debug_false'], | |
161 | 'class': 'django.utils.log.AdminEmailHandler' | |
162 | } | |
163 | }, | |
164 | 'loggers': { | |
165 | 'django.request': { | |
166 | 'handlers': ['mail_admins'], | |
167 | 'level': 'ERROR', | |
168 | 'propagate': True, | |
169 | }, | |
170 | } | |
171 | } |