|
1 """ |
|
2 Django settings for iconolab-episteme project. |
|
3 |
|
4 Generated by 'django-admin startproject' using Django 1.9.5. |
|
5 |
|
6 For more information on this file, see |
|
7 https://docs.djangoproject.com/en/1.9/topics/settings/ |
|
8 |
|
9 For the full list of settings and their values, see |
|
10 https://docs.djangoproject.com/en/1.9/ref/settings/ |
|
11 """ |
|
12 import logging |
|
13 import os |
|
14 |
|
15 from iconolab_episteme.settings import * |
|
16 |
|
17 CONTACT_EMAIL = 'youremail@yourprovider.fr' |
|
18 |
|
19 # Build paths inside the project like this: os.path.join(BASE_DIR, ...) |
|
20 # BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) |
|
21 |
|
22 # STATIC_ROOT = os.path.abspath(os.path.join(BASE_DIR, '../../../run/web/static/site')) |
|
23 # MEDIA_ROOT = os.path.abspath(os.path.join(BASE_DIR, '../../../run/web')) |
|
24 BASE_DIR = '/mnt/c/Users/Riwad/Desktop/IRI/ICONOLAB/iconolab-episteme/src/iconolab_episteme' |
|
25 |
|
26 STATIC_ROOT = '/mnt/c/Users/Riwad/Desktop/IRI/ICONOLAB/iconolab-episteme/run/web/static/site' |
|
27 MEDIA_ROOT = '/mnt/c/Users/Riwad/Desktop/IRI/ICONOLAB/iconolab-episteme/run/web/media' |
|
28 |
|
29 # dev_mode useful for src_js |
|
30 # We need to add 'iconolab.utils.context_processors.env' to context processor |
|
31 |
|
32 # When JS_DEV_MODE is True, the Webpack dev server should be started |
|
33 JS_DEV_MODE = False |
|
34 # STATICFILES_DIRS = [ |
|
35 # os.path.join(BASE_DIR, 'static'), |
|
36 # os.path.join(BASE_DIR, 'media'), |
|
37 # ] |
|
38 |
|
39 if JS_DEV_MODE: |
|
40 SRC_JS_PATH = os.path.join(BASE_DIR, '..', '..', 'src_js') |
|
41 STATICFILES_DIRS.append(SRC_JS_PATH) |
|
42 |
|
43 |
|
44 BASE_URL = 'http://localhost:8000' |
|
45 if JS_DEV_MODE: |
|
46 STATIC_URL = 'http://localhost:8001/static/' |
|
47 else: |
|
48 STATIC_URL = '/static/' |
|
49 MEDIA_URL = '/media/' |
|
50 |
|
51 LOGIN_URL = '/account/login/' |
|
52 |
|
53 # Quick-start development settings - unsuitable for production |
|
54 # See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/ |
|
55 |
|
56 # SECURITY WARNING: keep the secret key used in production secret! |
|
57 SECRET_KEY = '#8)+upuo3vc7fi15czxz53ml7*(1__q8hg=m&+9ylq&st1_kqv' |
|
58 |
|
59 # SECURITY WARNING: don't run with debug turned on in production! |
|
60 DEBUG = True |
|
61 THUMBNAIL_DEBUG = True |
|
62 |
|
63 ALLOWED_HOSTS = [] |
|
64 |
|
65 |
|
66 # Application definition |
|
67 |
|
68 |
|
69 COMMENTS_APP = "django_comments_xtd" |
|
70 COMMENTS_XTD_MODEL = "iconolab.models.IconolabComment" |
|
71 COMMENTS_XTD_FORM_CLASS = 'iconolab.forms.comments.IconolabCommentForm' |
|
72 COMMENTS_XTD_MAX_THREAD_LEVEL = 1 |
|
73 COMMENTS_PER_PAGE_DEFAULT = 10 |
|
74 |
|
75 SITE_ID = 1 |
|
76 |
|
77 TEMPLATES = [ |
|
78 { |
|
79 'BACKEND': 'django.template.backends.django.DjangoTemplates', |
|
80 'DIRS': [], |
|
81 'APP_DIRS': True, |
|
82 'OPTIONS': { |
|
83 'context_processors': [ |
|
84 'django.template.context_processors.debug', |
|
85 'django.template.context_processors.request', |
|
86 'django.contrib.auth.context_processors.auth', |
|
87 'django.contrib.messages.context_processors.messages', |
|
88 'django.template.context_processors.media', |
|
89 'django.template.context_processors.static', |
|
90 'django.template.context_processors.i18n', |
|
91 'iconolab.utils.context_processors.env', |
|
92 ], |
|
93 # 'libraries': { |
|
94 # 'iconolab_episteme_tags':'iconolab_episteme.templatetags.iconolab_episteme_tags' |
|
95 # } |
|
96 }, |
|
97 }, |
|
98 ] |
|
99 |
|
100 WSGI_APPLICATION = 'iconolab_episteme.wsgi.application' |
|
101 |
|
102 |
|
103 # Database |
|
104 # https://docs.djangoproject.com/en/1.9/ref/settings/#databases |
|
105 |
|
106 DATABASES = { |
|
107 'default': { |
|
108 'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. |
|
109 'NAME': 'iconolabepisteme', # Or path to database file if using sqlite3. |
|
110 'USER': 'iri', # Not used with sqlite3. |
|
111 'PASSWORD': 'iri', # Not used with sqlite3. |
|
112 'HOST': '192.168.99.100', # Set to empty string for localhost. Not used with sqlite3. |
|
113 'PORT': '5432', # Set to empty string for default. Not used with sqlite3. |
|
114 } |
|
115 } |
|
116 |
|
117 # Logging |
|
118 |
|
119 LOG_FILE = os.path.abspath(os.path.join(BASE_DIR,"../../run/log/log.txt")) |
|
120 IMPORT_LOG_FILE = os.path.abspath(os.path.join(BASE_DIR,"../../run/log/import_log.txt")) |
|
121 IMPORT_LOGGER_NAME = "import_command" |
|
122 LOG_LEVEL = logging.DEBUG |
|
123 LOGGING = { |
|
124 'version': 1, |
|
125 'disable_existing_loggers': True, |
|
126 'filters': { |
|
127 'require_debug_false': { |
|
128 '()': 'django.utils.log.RequireDebugFalse' |
|
129 } |
|
130 }, |
|
131 'formatters' : { |
|
132 'simple' : { |
|
133 'format': "%(asctime)s - %(levelname)s : %(message)s", |
|
134 }, |
|
135 'semi-verbose': { |
|
136 'format': '%(levelname)s %(asctime)s %(module)s %(message)s' |
|
137 }, |
|
138 }, |
|
139 'handlers': { |
|
140 'mail_admins': { |
|
141 'level': 'ERROR', |
|
142 'filters': ['require_debug_false'], |
|
143 'class': 'django.utils.log.AdminEmailHandler' |
|
144 }, |
|
145 'stream_to_console': { |
|
146 'level': LOG_LEVEL, |
|
147 'class': 'logging.StreamHandler' |
|
148 }, |
|
149 'file': { |
|
150 'level': LOG_LEVEL, |
|
151 'class': 'logging.FileHandler', |
|
152 'filename': LOG_FILE, |
|
153 'formatter': 'semi-verbose', |
|
154 }, |
|
155 'import_file': { |
|
156 'level': LOG_LEVEL, |
|
157 'class': 'logging.FileHandler', |
|
158 'filename': IMPORT_LOG_FILE, |
|
159 'formatter': 'semi-verbose', |
|
160 } |
|
161 }, |
|
162 'loggers': { |
|
163 'django.request': { |
|
164 'handlers': ['file'], |
|
165 'level': LOG_LEVEL, |
|
166 'propagate': True, |
|
167 }, |
|
168 'iconolab': { |
|
169 'handlers': ['file'], |
|
170 'level': LOG_LEVEL, |
|
171 'propagate': True, |
|
172 }, |
|
173 'import_command': { |
|
174 'handlers': ['import_file'], |
|
175 'level': LOG_LEVEL, |
|
176 'propagate': True, |
|
177 }, |
|
178 } |
|
179 } |
|
180 |
|
181 ELASTICSEARCH_DSL = { |
|
182 'default': { |
|
183 'hosts': '192.168.99.100:9200' |
|
184 }, |
|
185 } |
|
186 |
|
187 CACHES = { |
|
188 'default': { |
|
189 'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache', |
|
190 'LOCATION': os.path.join(MEDIA_ROOT, 'cache'), |
|
191 # 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', |
|
192 # 'LOCATION': 'unix:/var/run/memcached/memcached.socket', |
|
193 # 'KEY_PREFIX': 'ldt', |
|
194 } |
|
195 } |
|
196 # Password validation |
|
197 # https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators |
|
198 |
|
199 AUTH_PASSWORD_VALIDATORS = [ |
|
200 { |
|
201 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', |
|
202 }, |
|
203 { |
|
204 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', |
|
205 }, |
|
206 { |
|
207 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', |
|
208 }, |
|
209 { |
|
210 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', |
|
211 }, |
|
212 ] |
|
213 |
|
214 |
|
215 # Internationalization |
|
216 # https://docs.djangoproject.com/en/1.9/topics/i18n/ |
|
217 |
|
218 LANGUAGE_CODE = 'en-us' |
|
219 |
|
220 TIME_ZONE = 'UTC' |
|
221 |
|
222 USE_I18N = True |
|
223 |
|
224 USE_L10N = True |
|
225 |
|
226 USE_TZ = True |
|
227 |
|
228 INTERNAL_TAGS_URL = BASE_URL |
|
229 |
|
230 ESO_NOTICE_BASE_URL = "https://www.eso.org/public/france/images/" |
|
231 |
|
232 RELEVANT_TAGS_MIN_SCORE = 3 |
|
233 ACCURATE_TAGS_MIN_SCORE = 3 |