· 6 years ago · Apr 23, 2019, 07:52 AM
1(venv_modoboa) modoboa@testdebian:~$ pip list
2Package Version
3------------------------------- -----------
4asn1crypto 0.24.0
5bcrypt 3.1.4
6certifi 2019.3.9
7cffi 1.12.3
8chardet 3.0.4
9Click 7.0
10coreapi 2.3.3
11coreapi-cli 1.0.6
12coreschema 0.0.4
13cryptography 2.6.1
14dj-database-url 0.5.0
15Django 1.11.20
16django-braces 1.11.0
17django-ckeditor 5.2.2
18django-reversion 2.0.12
19django-subcommand2 0.1.1
20django-xforwardedfor-middleware 2.0
21djangorestframework 3.7.3
22dnspython 1.15.0
23feedparser 5.2.1
24futures 3.1.1
25gevent 1.4.0
26greenlet 0.4.15
27gunicorn 19.9.0
28idna 2.8
29itypes 1.1.0
30Jinja2 2.10.1
31jsonfield 2.0.2
32LEPL 5.1.3
33lxml 4.3.3
34MarkupSafe 1.1.1
35modoboa 1.13.1
36modoboa-dmarc 1.1.0
37modoboa-stats 1.4.1
38modoboa-webmail 1.5.0
39mysqlclient 1.4.2.post1
40passlib 1.7.1
41Pillow 6.0.0
42pip 19.0.3
43pkg-resources 0.0.0
44progressbar33 2.4
45py-dateutil 2.2
46pycparser 2.19
47pytz 2019.1
48requests 2.21.0
49requests-file 1.4.3
50rfc6266 0.0.4
51rrdtool 0.1.14
52setuptools 41.0.0
53six 1.12.0
54tldextract 2.2.1
55uritemplate 3.0.0
56urllib3 1.24.2
57wheel 0.33.1
58
59
60# -*- coding: utf-8 -*-
61"""
62Django settings for ffmwu_modoboa project.
63
64For more information on this file, see
65https://docs.djangoproject.com/en/1.11/topics/settings/
66
67For the full list of settings and their values, see
68https://docs.djangoproject.com/en/1.11/ref/settings/
69"""
70
71from __future__ import unicode_literals
72
73from logging.handlers import SysLogHandler
74import os
75
76
77
78# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
79BASE_DIR = os.path.realpath(os.path.dirname(os.path.dirname(__file__)))
80
81
82# Quick-start development settings - unsuitable for production
83# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
84
85# SECURITY WARNING: keep the secret key used in production secret!
86SECRET_KEY = 'xxxx'
87
88# SECURITY WARNING: don't run with debug turned on in production!
89DEBUG = False
90
91ALLOWED_HOSTS = [
92 'xxxxx',
93]
94
95SITE_ID = 1
96
97# A list of all the people who get code error notifications. When DEBUG=False
98# and a view raises an exception, Django will email these people with the full
99# exception information.
100# See https://docs.djangoproject.com/en/dev/ref/settings/#admins
101#ADMINS = [('Administrator', 'admin@example.net')]
102
103# The email address that error messages come from, such as those sent to ADMINS
104#SERVER_EMAIL = 'webmaster@example.net'
105
106# Security settings
107
108X_FRAME_OPTIONS = "SAMEORIGIN"
109CSRF_COOKIE_SECURE = True
110SESSION_COOKIE_SECURE = True
111
112# Application definition
113
114INSTALLED_APPS = (
115 'django.contrib.auth',
116 'django.contrib.contenttypes',
117 'django.contrib.sessions',
118 'django.contrib.messages',
119 'django.contrib.sites',
120 'django.contrib.staticfiles',
121 'reversion',
122 'ckeditor',
123 'ckeditor_uploader',
124 'rest_framework',
125 'rest_framework.authtoken',
126)
127
128# A dedicated place to register Modoboa applications
129# Do not delete it.
130# Do not change the order.
131MODOBOA_APPS = (
132 'modoboa',
133 'modoboa.core',
134 'modoboa.lib',
135 'modoboa.admin',
136 'modoboa.transport',
137 'modoboa.relaydomains',
138 'modoboa.limits',
139 'modoboa.parameters',
140 'modoboa.dnstools',
141 # Modoboa extensions here.
142 'modoboa_dmarc',
143 'modoboa_stats',
144 'modoboa_webmail',
145
146)
147
148INSTALLED_APPS += MODOBOA_APPS
149
150AUTH_USER_MODEL = 'core.User'
151
152MIDDLEWARE = (
153 'x_forwarded_for.middleware.XForwardedForMiddleware',
154 'django.contrib.sessions.middleware.SessionMiddleware',
155 'django.middleware.common.CommonMiddleware',
156 'django.middleware.csrf.CsrfViewMiddleware',
157 'django.contrib.auth.middleware.AuthenticationMiddleware',
158 'django.contrib.messages.middleware.MessageMiddleware',
159 'django.middleware.locale.LocaleMiddleware',
160 'django.middleware.clickjacking.XFrameOptionsMiddleware',
161 'modoboa.core.middleware.LocalConfigMiddleware',
162 'modoboa.lib.middleware.AjaxLoginRedirect',
163 'modoboa.lib.middleware.CommonExceptionCatcher',
164 'modoboa.lib.middleware.RequestCatcherMiddleware',
165)
166
167AUTHENTICATION_BACKENDS = (
168 # 'modoboa.lib.authbackends.LDAPBackend',
169 # 'modoboa.lib.authbackends.SMTPBackend',
170 'django.contrib.auth.backends.ModelBackend',
171)
172
173# SMTP authentication
174# AUTH_SMTP_SERVER_ADDRESS = 'localhost'
175# AUTH_SMTP_SERVER_PORT = 25
176# AUTH_SMTP_SECURED_MODE = None # 'ssl' or 'starttls' are accepted
177
178
179TEMPLATES = [
180 {
181 'BACKEND': 'django.template.backends.django.DjangoTemplates',
182 'DIRS': [],
183 'APP_DIRS': True,
184 'OPTIONS': {
185 'context_processors': [
186 'django.template.context_processors.debug',
187 'django.template.context_processors.request',
188 'django.contrib.auth.context_processors.auth',
189 'django.template.context_processors.i18n',
190 'django.template.context_processors.media',
191 'django.template.context_processors.static',
192 'django.template.context_processors.tz',
193 'django.contrib.messages.context_processors.messages',
194 'modoboa.core.context_processors.top_notifications',
195 ],
196 'debug': False,
197 },
198 },
199]
200
201ROOT_URLCONF = 'ffmwu_modoboa.urls'
202
203WSGI_APPLICATION = 'ffmwu_modoboa.wsgi.application'
204
205
206# Database
207# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
208
209DATABASES = {
210
211 'default': {
212 'ENGINE': 'django.db.backends.mysql',
213 'NAME': 'modoboa',
214 'USER': 'modoboa',
215 'PASSWORD': 'xxxx',
216 'HOST': '127.0.0.1',
217 'PORT': '3306',
218 'ATOMIC_REQUESTS': True,
219 'OPTIONS' : {
220 "init_command" : 'SET foreign_key_checks = 0;',
221 },
222 },
223
224}
225
226# Internationalization
227# https://docs.djangoproject.com/en/1.11/topics/i18n/
228
229LANGUAGE_CODE = 'en-us'
230
231TIME_ZONE = 'Europe/Berlin'
232
233USE_I18N = True
234
235USE_L10N = True
236
237USE_TZ = True
238
239# Static files (CSS, JavaScript, Images)
240# https://docs.djangoproject.com/en/1.11/howto/static-files/
241
242STATIC_URL = '/sitestatic/'
243STATIC_ROOT = os.path.join(BASE_DIR, 'sitestatic')
244STATICFILES_DIRS = (
245 '/home/modoboa/venv_modoboa/lib/python3.5/site-packages/modoboa/bower_components',
246)
247
248MEDIA_URL = '/media/'
249MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
250
251# Rest framework settings
252
253REST_FRAMEWORK = {
254 'DEFAULT_AUTHENTICATION_CLASSES': (
255 'rest_framework.authentication.TokenAuthentication',
256 'rest_framework.authentication.SessionAuthentication',
257 ),
258}
259
260# Modoboa settings
261# MODOBOA_CUSTOM_LOGO = os.path.join(MEDIA_URL, "custom_logo.png")
262
263# DOVECOT_LOOKUP_PATH = ('/path/to/dovecot', )
264
265MODOBOA_API_URL = 'https://api.modoboa.org/1/'
266
267# Password validation
268# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators
269
270AUTH_PASSWORD_VALIDATORS = [
271 {
272 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
273 },
274 {
275 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
276 },
277 {
278 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
279 },
280 {
281 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
282 },
283 {
284 'NAME': 'modoboa.core.password_validation.ComplexityValidator',
285 'OPTIONS': {
286 'upper': 1,
287 'lower': 1,
288 'digits': 1,
289 'specials': 0
290 }
291 },
292]
293
294# CKeditor
295
296CKEDITOR_UPLOAD_PATH = "uploads/"
297
298CKEDITOR_IMAGE_BACKEND = "pillow"
299
300CKEDITOR_RESTRICT_BY_USER = True
301
302CKEDITOR_BROWSE_SHOW_DIRS = True
303
304CKEDITOR_ALLOW_NONIMAGE_FILES = False
305
306CKEDITOR_CONFIGS = {
307 'default': {
308 'allowedContent': True,
309 'toolbar': 'Modoboa',
310 'width': None,
311 'toolbar_Modoboa': [
312 ['Bold', 'Italic', 'Underline'],
313 ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
314 ['BidiLtr', 'BidiRtl', 'Language'],
315 ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent'],
316 ['Undo', 'Redo'],
317 ['Link', 'Unlink', 'Anchor', '-', 'Smiley'],
318 ['TextColor', 'BGColor', '-', 'Source'],
319 ['Font', 'FontSize'],
320 ['Image', ],
321 ['SpellChecker']
322 ],
323 },
324}
325
326# Logging configuration
327
328LOGGING = {
329 'version': 1,
330 'formatters': {
331 'syslog': {
332 'format': '%(name)s: %(levelname)s %(message)s'
333 },
334 },
335 'handlers': {
336 'mail-admins': {
337 'level': 'ERROR',
338 'class': 'django.utils.log.AdminEmailHandler',
339 'include_html': True
340 },
341 'syslog-auth': {
342 'class': 'logging.handlers.SysLogHandler',
343 'facility': SysLogHandler.LOG_AUTH,
344 'formatter': 'syslog'
345 },
346 'modoboa': {
347 'class': 'modoboa.core.loggers.SQLHandler',
348 }
349 },
350 'loggers': {
351 'django': {
352 'handlers': ['mail-admins'],
353 'level': 'ERROR',
354 'propagate': False
355 },
356 'modoboa.auth': {
357 'handlers': ['syslog-auth', 'modoboa'],
358 'level': 'INFO',
359 'propagate': False
360 },
361 'modoboa.admin': {
362 'handlers': ['modoboa'],
363 'level': 'INFO',
364 'propagate': False
365 }
366 }
367}
368
369SILENCED_SYSTEM_CHECKS = [
370 "security.W019", # modoboa uses iframes to display e-mails
371]
372
373# Load settings from extensions