|
@@ -0,0 +1,247 @@
|
|
1
|
+"""
|
|
2
|
+Django settings for this project.
|
|
3
|
+
|
|
4
|
+Generated by 'django-admin startproject' using Django 2.2.3.
|
|
5
|
+
|
|
6
|
+For more information on this file, see
|
|
7
|
+https://docs.djangoproject.com/en/2.2/topics/settings/
|
|
8
|
+
|
|
9
|
+For the full list of settings and their values, see
|
|
10
|
+https://docs.djangoproject.com/en/2.2/ref/settings/
|
|
11
|
+"""
|
|
12
|
+
|
|
13
|
+try:
|
|
14
|
+ from config import config
|
|
15
|
+ # required keys: SECRET_KEY
|
|
16
|
+ # optional keys: ALLOWED_HOSTS, DEFAULT_THEME
|
|
17
|
+except ImportError:
|
|
18
|
+ config = {}
|
|
19
|
+import os
|
|
20
|
+import random
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
|
24
|
+#
|
|
25
|
+BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+# Quick-start development settings - unsuitable for production
|
|
29
|
+# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
|
|
30
|
+
|
|
31
|
+# SECURITY WARNING: keep the secret key used in production secret!
|
|
32
|
+#
|
|
33
|
+try:
|
|
34
|
+ SECRET_KEY = config['SECRET_KEY']
|
|
35
|
+except KeyError:
|
|
36
|
+ chars = 'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'
|
|
37
|
+ s_key = ''.join([random.choice(chars) for n in range(50)])
|
|
38
|
+ secret_key_warning = "You need to create a config.py file including a variable config which is a dict with at least a SECRET_KEY definition (e.g.: %s)." % repr(s_key)
|
|
39
|
+ raise KeyError(secret_key_warning)
|
|
40
|
+# SECURITY WARNING: don't run with debug turned on in production!
|
|
41
|
+#
|
|
42
|
+DEBUG = True
|
|
43
|
+
|
|
44
|
+ALLOWED_HOSTS = config.get('ALLOWED_HOSTS', [])
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+# Application definition
|
|
48
|
+#
|
|
49
|
+INSTALLED_APPS = [
|
|
50
|
+ 'patt.apps.PattConfig',
|
|
51
|
+ 'themes.apps.ThemesConfig',
|
|
52
|
+ 'users.apps.UsersConfig',
|
|
53
|
+ 'mycreole.apps.MycreoleConfig',
|
|
54
|
+ #
|
|
55
|
+ 'django.contrib.admin',
|
|
56
|
+ 'django.contrib.auth',
|
|
57
|
+ 'django.contrib.contenttypes',
|
|
58
|
+ 'django.contrib.sessions',
|
|
59
|
+ 'django.contrib.messages',
|
|
60
|
+ 'django.contrib.staticfiles',
|
|
61
|
+ 'simple_history',
|
|
62
|
+]
|
|
63
|
+
|
|
64
|
+MIDDLEWARE = [
|
|
65
|
+ 'django.middleware.security.SecurityMiddleware',
|
|
66
|
+ 'django.contrib.sessions.middleware.SessionMiddleware',
|
|
67
|
+ 'django.middleware.locale.LocaleMiddleware',
|
|
68
|
+ 'django.middleware.common.CommonMiddleware',
|
|
69
|
+ 'django.middleware.csrf.CsrfViewMiddleware',
|
|
70
|
+ 'django.contrib.auth.middleware.AuthenticationMiddleware',
|
|
71
|
+ 'django.contrib.messages.middleware.MessageMiddleware',
|
|
72
|
+ 'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
|
73
|
+ 'simple_history.middleware.HistoryRequestMiddleware',
|
|
74
|
+ 'users.middleware.SettingsMiddleware',
|
|
75
|
+]
|
|
76
|
+
|
|
77
|
+ROOT_URLCONF = 'main.urls'
|
|
78
|
+
|
|
79
|
+TEMPLATES = [
|
|
80
|
+ {
|
|
81
|
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
|
82
|
+ 'DIRS': [],
|
|
83
|
+ 'APP_DIRS': True,
|
|
84
|
+ 'OPTIONS': {
|
|
85
|
+ 'context_processors': [
|
|
86
|
+ 'django.template.context_processors.debug',
|
|
87
|
+ 'django.template.context_processors.request',
|
|
88
|
+ 'django.contrib.auth.context_processors.auth',
|
|
89
|
+ 'django.contrib.messages.context_processors.messages',
|
|
90
|
+ ],
|
|
91
|
+ },
|
|
92
|
+ },
|
|
93
|
+]
|
|
94
|
+
|
|
95
|
+WSGI_APPLICATION = 'main.wsgi.application'
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+# Database
|
|
99
|
+# https://docs.djangoproject.com/en/2.2/ref/settings/#databases
|
|
100
|
+#
|
|
101
|
+DATABASES = {
|
|
102
|
+ 'default': {
|
|
103
|
+ 'ENGINE': 'django.db.backends.sqlite3',
|
|
104
|
+ 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
|
105
|
+ }
|
|
106
|
+}
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+# Password validation
|
|
110
|
+# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators
|
|
111
|
+#
|
|
112
|
+AUTH_PASSWORD_VALIDATORS = [
|
|
113
|
+ {
|
|
114
|
+ 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
|
115
|
+ },
|
|
116
|
+ {
|
|
117
|
+ 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
|
118
|
+ },
|
|
119
|
+ {
|
|
120
|
+ 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
|
121
|
+ },
|
|
122
|
+ {
|
|
123
|
+ 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
|
124
|
+ },
|
|
125
|
+]
|
|
126
|
+
|
|
127
|
+# Search Engine
|
|
128
|
+#
|
|
129
|
+WHOOSH_PATH = os.path.join(BASE_DIR, 'data', 'whoosh_index')
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+# Internationalization
|
|
133
|
+# https://docs.djangoproject.com/en/2.2/topics/i18n/
|
|
134
|
+#
|
|
135
|
+LANGUAGE_CODE = 'en-us'
|
|
136
|
+LANGUAGES = [
|
|
137
|
+ ('en', 'English'),
|
|
138
|
+ ('de', 'Deutsch'),
|
|
139
|
+]
|
|
140
|
+
|
|
141
|
+TIME_ZONE = 'UTC'
|
|
142
|
+
|
|
143
|
+USE_I18N = True
|
|
144
|
+LOCALE_PATHS = [
|
|
145
|
+ os.path.join(BASE_DIR, 'themes', 'locale'),
|
|
146
|
+ os.path.join(BASE_DIR, 'users', 'locale'),
|
|
147
|
+ os.path.join(BASE_DIR, 'patt', 'locale'),
|
|
148
|
+]
|
|
149
|
+
|
|
150
|
+USE_L10N = True
|
|
151
|
+
|
|
152
|
+USE_TZ = True
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+# Static files (CSS, JavaScript, Images)
|
|
156
|
+# https://docs.djangoproject.com/en/2.2/howto/static-files/
|
|
157
|
+#
|
|
158
|
+STATIC_ROOT = os.path.join(BASE_DIR, 'data', 'static')
|
|
159
|
+STATIC_URL = '/static/'
|
|
160
|
+
|
|
161
|
+MEDIA_ROOT = os.path.join(BASE_DIR, 'data', 'media')
|
|
162
|
+MEDIA_URL = '/media/'
|
|
163
|
+
|
|
164
|
+MYCREOLE_ROOT = os.path.join(BASE_DIR, 'data', 'mycreole')
|
|
165
|
+MYCREOLE_ATTACHMENT_ACCESS = {
|
|
166
|
+ 'read': 'patt.access.read_attachment',
|
|
167
|
+ 'modify': 'patt.access.modify_attachment',
|
|
168
|
+}
|
|
169
|
+MYCREOLE_EXT_FILTERS = [
|
|
170
|
+ 'patt.creole.task_link_filter',
|
|
171
|
+ 'patt.creole.tasklist_link_filter',
|
|
172
|
+]
|
|
173
|
+
|
|
174
|
+# Session parameters
|
|
175
|
+#
|
|
176
|
+PERSISTENT_SESSION_VARIABLES = []
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+# Logging Configuration
|
|
180
|
+#
|
|
181
|
+debug_handler = 'console'
|
|
182
|
+default_handler = [debug_handler] if DEBUG else ['console']
|
|
183
|
+#
|
|
184
|
+LOGGING = {
|
|
185
|
+ 'version': 1,
|
|
186
|
+ 'disable_existing_loggers': False,
|
|
187
|
+ 'formatters': {
|
|
188
|
+ 'short': {
|
|
189
|
+ 'format': "%(asctime)s \"%(name)s - %(levelname)s - %(message)s\"",
|
|
190
|
+ 'datefmt': '[%d/%b/%Y %H:%M:%S]',
|
|
191
|
+ },
|
|
192
|
+ 'long': {
|
|
193
|
+ 'format': """~~~~(%(levelname)-10s)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
194
|
+File "%(pathname)s", line %(lineno)d, in %(funcName)s
|
|
195
|
+%(asctime)s: %(name)s - %(message)s
|
|
196
|
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~""",
|
|
197
|
+ },
|
|
198
|
+ },
|
|
199
|
+ 'handlers': {
|
|
200
|
+ 'console': {
|
|
201
|
+ 'level': 'DEBUG',
|
|
202
|
+ 'class': 'logging.StreamHandler',
|
|
203
|
+ 'formatter': 'short',
|
|
204
|
+ },
|
|
205
|
+ 'console_long': {
|
|
206
|
+ 'level': 'DEBUG',
|
|
207
|
+ 'class': 'logging.StreamHandler',
|
|
208
|
+ 'formatter': 'long',
|
|
209
|
+ },
|
|
210
|
+ },
|
|
211
|
+ 'loggers': {
|
|
212
|
+ 'AUTH': {
|
|
213
|
+ 'handlers': default_handler,
|
|
214
|
+ 'level': 'INFO',
|
|
215
|
+ 'propagate': False,
|
|
216
|
+ },
|
|
217
|
+ 'ACC': {
|
|
218
|
+ 'handlers': default_handler,
|
|
219
|
+ 'level': 'INFO',
|
|
220
|
+ 'propagate': False,
|
|
221
|
+ },
|
|
222
|
+ 'APP': {
|
|
223
|
+ 'handlers': default_handler,
|
|
224
|
+ 'level': 'INFO',
|
|
225
|
+ 'propagate': False,
|
|
226
|
+ },
|
|
227
|
+ 'WHOOSH': {
|
|
228
|
+ 'handlers': default_handler,
|
|
229
|
+ 'level': 'INFO',
|
|
230
|
+ 'propagate': False,
|
|
231
|
+ },
|
|
232
|
+ 'FSTOOLS': {
|
|
233
|
+ 'handlers': default_handler,
|
|
234
|
+ 'level': 'INFO',
|
|
235
|
+ 'propagate': False,
|
|
236
|
+ },
|
|
237
|
+ },
|
|
238
|
+}
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+# Other Configuration issues
|
|
242
|
+#
|
|
243
|
+LOGIN_URL = 'users-login'
|
|
244
|
+
|
|
245
|
+# App Configuration
|
|
246
|
+#
|
|
247
|
+DEFAULT_THEME = config.get('DEFAULT_THEME', 'clear-green')
|