· 9 years ago · Oct 10, 2016, 02:40 PM
1# -*- coding: utf-8 -*-
2"""
3Django settings for project project.
4
5For more information on this file, see
6https://docs.djangoproject.com/en/1.7/topics/settings/
7
8For the full list of settings and their values, see
9https://docs.djangoproject.com/en/1.7/ref/settings/
10"""
11
12# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
13import os
14import ldap3 as ldap
15
16BASE_DIR = os.path.dirname(os.path.dirname(__file__))
17
18# Quick-start development settings - unsuitable for production
19# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
20
21# SECURITY WARNING: keep the secret key used in production secret!
22SECRET_KEY = '4lgrm8+9$ww$2opy__r0tv0&+06tyuw0r5@$m##n9b#fmyt5k^'
23
24# SECURITY WARNING: don't run with debug turned on in production!
25DEBUG = True
26
27TEMPLATE_DEBUG = True
28
29ALLOWED_HOSTS = []
30
31AUTH_PROFILE_MODULE = "project_app.UserProfile"
32
33DRAL_CHECK_DOMAIN = True
34DRAL_STRIP_DOMAIN = True
35DRAL_DOMAINS = [
36 'batigere'
37]
38
39# Application definition
40AUTHENTICATION_BACKENDS = (
41 #'django_auth_ldap.backend.LDAPBackend',
42 'project_app.backends.ActiveDirectoryBackend',
43 'django.contrib.auth.backends.ModelBackend'
44)
45
46INSTALLED_APPS = (
47 'bootstrap3',
48 'django_admin_bootstrapped.bootstrap3',
49 'django_admin_bootstrapped',
50 'django.contrib.admin',
51 'django.contrib.auth',
52 'django.contrib.contenttypes',
53 'django.contrib.sessions',
54 'django.contrib.messages',
55 'django.contrib.staticfiles',
56 'daterange_filter',
57 'rest_framework',
58 'django_tables2',
59 'django_activeurl',
60 'debug_toolbar',
61 'project_app.settings.Config',
62)
63
64MIDDLEWARE_CLASSES = (
65 'django.contrib.sessions.middleware.SessionMiddleware',
66 'django.middleware.common.CommonMiddleware',
67 #'django.middleware.csrf.CsrfViewMiddleware',
68 'django.contrib.auth.middleware.AuthenticationMiddleware',
69 #'django_remote_auth_ldap.middleware.RemoteUserMiddleware',
70 'django.contrib.auth.middleware.RemoteUserMiddleware',
71 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
72 'django.contrib.messages.middleware.MessageMiddleware',
73 'django.middleware.clickjacking.XFrameOptionsMiddleware',
74 # 'debug_toolbar.middleware.DebugToolbarMiddleware',
75)
76TEMPLATE_CONTEXT_PROCESSORS = (
77 "django.contrib.auth.context_processors.auth",
78 "django.core.context_processors.debug",
79 "django.core.context_processors.i18n",
80 "django.core.context_processors.media",
81 "django.core.context_processors.static",
82 "django.core.context_processors.tz",
83 "django.contrib.messages.context_processors.messages",
84 'django.core.context_processors.request'
85)
86ROOT_URLCONF = 'project.urls'
87DEBUG_TOOLBAR_PATCH_SETTINGS = True
88WSGI_APPLICATION = 'project.wsgi.application'
89JQUERY_URL = None
90
91# Database
92# https://docs.djangoproject.com/en/1.7/ref/settings/#databases
93
94# DATABASES = {
95# 'default': {
96# 'ENGINE': 'django.db.backends.sqlite3',
97# 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
98# }
99# }
100
101DB_BASE = 'batigere_pm'
102
103DATABASES = {
104 'default': {
105 'NAME': DB_BASE,
106 'ENGINE': 'django.db.backends.mysql',
107 'HOST': 'sql.espace-clients.com',
108 'USER': DB_BASE,
109 'PASSWORD': 'eyBMQdbG5FaRFah8',
110 }
111}
112
113# Internationalization
114# https://docs.djangoproject.com/en/1.7/topics/i18n/
115
116LANGUAGE_CODE = 'fr-fr'
117
118TIME_ZONE = 'Europe/Paris'
119
120USE_I18N = True
121
122USE_L10N = True
123
124USE_TZ = True
125
126
127# Static files (CSS, JavaScript, Images)
128# https://docs.djangoproject.com/en/1.7/howto/static-files/
129TEMPLATE_DIRS = (
130 os.path.join(BASE_DIR, 'project', 'templates'),
131 os.path.join(BASE_DIR, 'project_app', 'templates')
132)
133
134LOGIN_URL = '/access/refused/'
135STATIC_URL = '/static/'
136STATIC_ROOT = os.path.realpath(os.path.join(BASE_DIR, 'project', 'static'))
137
138MEDIA_ROOT = os.path.realpath(os.path.join(BASE_DIR, 'project', 'site_media'))
139MEDIA_URL = '/site_media/'
140
141SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer'
142
143GRAPPELLI_ADMIN_TITLE = 'Administration des propriétés Batigere'
144LOGIN_REDIRECT_URL = '/'
145
146from django.contrib import messages
147
148MESSAGE_TAGS = {
149 messages.SUCCESS: 'alert-success success',
150 messages.WARNING: 'alert-warning warning',
151 messages.ERROR: 'alert-danger error'
152}
153
154PROSPECT_CNT_PER_PAGE = 20
155PROPERTY_CNT_PER_PAGE = 20
156
157DJANGO_LOG_LEVEL=DEBUG
158
159LOGGING = {
160 'version': 1,
161 'disable_existing_loggers': False,
162 'formatters': {
163 'verbose': {
164 'format': "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s",
165 'datefmt': "%d/%b/%Y %H:%M:%S"
166 },
167 'simple': {
168 'format': '%(levelname)s %(message)s'
169 },
170 },
171 'handlers': {
172 'file': {
173 'level': 'DEBUG',
174 'class': 'logging.FileHandler',
175 'filename': os.path.join(BASE_DIR, 'logs', 'debug.log'),
176 'formatter': 'verbose'
177 },
178 'console' : {
179 'class': 'logging.StreamHandler',
180 }
181 },
182 'loggers': {
183 'django': {
184 'handlers':['file'],
185 'propagate': True,
186 'level':'DEBUG',
187 },
188 'properties': {
189 'handlers': ['file', 'console'],
190 'level': 'DEBUG',
191 },
192 'project_app': {
193 'handlers': ['file', 'console'],
194 'level': 'DEBUG',
195 },
196 'django_auth_ldap': {
197 'handlers': ['file', 'console'],
198 'level': 'DEBUG',
199 },
200 'django_remote_auth_ldap': {
201 'handlers': ['file', 'console'],
202 'level': 'DEBUG',
203 },
204 }
205}