@@ -1,508 +0,0 @@
1−# -*- coding: utf-8 -*-
2−# Copyright (C) 1998-2019 by the Free Software Foundation, Inc.
3−#
4−# This file is part of Postorius.
5−#
6−# Postorius is free software: you can redistribute it and/or modify it under
7−# the terms of the GNU General Public License as published by the Free
8−# Software Foundation, either version 3 of the License, or (at your option)
9−# any later version.
10−#
11−# Postorius is distributed in the hope that it will be useful, but WITHOUT
12−# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13−# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14−# more details.
15−#
16−# You should have received a copy of the GNU General Public License along with
17−# Postorius. If not, see <http://www.gnu.org/licenses/>.
18−
19−"""
20−Django settings for postorius project.
21−
22−For more information on this file, see
23−https://docs.djangoproject.com/en/1.9/topics/settings/
24−
25−For the full list of settings and their values, see
26−https://docs.djangoproject.com/en/1.9/ref/settings/
27−"""
28−
29−# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
30−import os
31−
32−# Compatibility with Bootstrap 3
33−from django.contrib.messages import constants as messages
34−
35−
36−BASE_DIR = os.path.dirname(os.path.abspath(__file__))
37−
38−
39−# Quick-start development settings - unsuitable for production
40−# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
41−
42−# SECURITY WARNING: don't run with debug turned on in production!
43−DEBUG = False
44−
45−ADMINS = (
46− #('Admin', 'webmaster@example.com'),
47−)
48−
49−SITE_ID = 1
50−
51−# Hosts/domain names that are valid for this site; required if DEBUG is False
52−# See https://docs.djangoproject.com/en/1.8/ref/settings/#allowed-hosts
53−ALLOWED_HOSTS = [
54− "localhost", # Archiving API from Mailman, keep it.
55− "127.0.0.1",
56− # Add here all production URLs you may have.
57− @ALLOWED_HOSTS@
58−]
59−
60−# Mailman API credentials
61−MAILMAN_REST_API_URL = 'http://localhost:8001'
62−MAILMAN_REST_API_USER = 'restadmin'
63−MAILMAN_REST_API_PASS = 'restpass'
64−MAILMAN_ARCHIVER_FROM = ('127.0.0.1', '::1')
65−
66−# Application definition
67−
68−INSTALLED_APPS = (
69− 'hyperkitty',
70− 'postorius',
71− 'django_mailman3',
72− # Uncomment the next line to enable the admin:
73− 'django.contrib.admin',
74− # Uncomment the next line to enable admin documentation:
75− # 'django.contrib.admindocs',
76− 'django.contrib.auth',
77− 'django.contrib.contenttypes',
78− 'django.contrib.sessions',
79− 'django.contrib.sites',
80− 'django.contrib.messages',
81− 'django.contrib.staticfiles',
82− 'rest_framework',
83− 'django_gravatar',
84− 'compressor',
85− 'haystack',
86− 'django_extensions',
87− 'django_q',
88− 'allauth',
89− 'allauth.account',
90− 'allauth.socialaccount',
91− 'django_mailman3.lib.auth.fedora',
92− 'allauth.socialaccount.providers.openid',
93− 'allauth.socialaccount.providers.github',
94− 'allauth.socialaccount.providers.gitlab',
95− 'allauth.socialaccount.providers.google',
96− #'allauth.socialaccount.providers.facebook',
97− #'allauth.socialaccount.providers.twitter',
98− 'allauth.socialaccount.providers.stackexchange',
99−)
100−
101−
102−MIDDLEWARE = (
103− 'django.middleware.security.SecurityMiddleware',
104− 'django.contrib.sessions.middleware.SessionMiddleware',
105− 'django.middleware.common.CommonMiddleware',
106− 'django.middleware.csrf.CsrfViewMiddleware',
107− 'django.contrib.auth.middleware.AuthenticationMiddleware',
108− 'django.contrib.messages.middleware.MessageMiddleware',
109− 'django.middleware.clickjacking.XFrameOptionsMiddleware',
110− 'django_mailman3.middleware.TimezoneMiddleware',
111−)
112−
113−ROOT_URLCONF = 'urls'
114−
115−
116−TEMPLATES = [
117− {
118− 'BACKEND': 'django.template.backends.django.DjangoTemplates',
119− 'DIRS': [],
120− 'APP_DIRS': True,
121− 'OPTIONS': {
122− 'context_processors': [
123− 'django.template.context_processors.debug',
124− 'django.template.context_processors.i18n',
125− 'django.template.context_processors.media',
126− 'django.template.context_processors.static',
127− 'django.template.context_processors.tz',
128− 'django.template.context_processors.csrf',
129− 'django.template.context_processors.request',
130− 'django.contrib.auth.context_processors.auth',
131− 'django.contrib.messages.context_processors.messages',
132− 'django_mailman3.context_processors.common',
133− 'hyperkitty.context_processors.common',
134− ],
135− },
136− },
137−]
138−
139−WSGI_APPLICATION = 'wsgi.application'
140−
141−
142−# Database
143−# https://docs.djangoproject.com/en/1.9/ref/settings/#databases
144−
145−DATABASES = {
146− 'default': {
147− 'ENGINE': 'django.db.backends.sqlite3',
148− 'NAME': '/var/lib/mailman-web/mailman-web.db'
149− }
150−}
151−
152−# Password validation
153−# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators
154−
155−AUTH_PASSWORD_VALIDATORS = [
156− {
157− 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
158− },
159− {
160− 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
161− },
162− {
163− 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
164− },
165− {
166− 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
167− },
168−]
169−
170−
171−# If you're behind a proxy, use the X-Forwarded-Host header
172−# See https://docs.djangoproject.com/en/1.8/ref/settings/#use-x-forwarded-host
173−# USE_X_FORWARDED_HOST = True
174−
175−# And if your proxy does your SSL encoding for you, set SECURE_PROXY_SSL_HEADER
176−# https://docs.djangoproject.com/en/1.8/ref/settings/#secure-proxy-ssl-header
177−# SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
178−# SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_SCHEME', 'https')
179−
180−# Other security settings
181−# SECURE_SSL_REDIRECT = True
182−# If you set SECURE_SSL_REDIRECT to True, make sure the SECURE_REDIRECT_EXEMPT
183−# contains at least this line:
184−# SECURE_REDIRECT_EXEMPT = [
185−# "archives/api/mailman/.*", # Request from Mailman.
186−# ]
187−# SESSION_COOKIE_SECURE = True
188−# SECURE_CONTENT_TYPE_NOSNIFF = True
189−# SECURE_BROWSER_XSS_FILTER = True
190−# CSRF_COOKIE_SECURE = True
191−# CSRF_COOKIE_HTTPONLY = True
192−# X_FRAME_OPTIONS = 'DENY'
193−
194−
195−# Internationalization
196−# https://docs.djangoproject.com/en/1.9/topics/i18n/
197−
198−LANGUAGE_CODE = 'en-us'
199−
200−TIME_ZONE = 'UTC'
201−
202−USE_I18N = True
203−
204−USE_L10N = True
205−
206−USE_TZ = True
207−
208−
209−# Static files (CSS, JavaScript, Images)
210−# https://docs.djangoproject.com/en/1.9/howto/static-files/
211−
212−
213−# Absolute path to the directory static files should be collected to.
214−# Don't put anything in this directory yourself; store your static files
215−# in apps' "static/" subdirectories and in STATICFILES_DIRS.
216−# Example: "/var/www/example.com/static/"
217−STATIC_ROOT = 'static'
218−
219−# URL prefix for static files.
220−# Example: "http://example.com/static/", "http://static.example.com/"
221−STATIC_URL = '/static/'
222−
223−# Additional locations of static files
224−STATICFILES_DIRS = (
225− # Put strings here, like "/home/html/static" or "C:/www/django/static".
226− # Always use forward slashes, even on Windows.
227− # Don't forget to use absolute paths, not relative paths.
228− # BASE_DIR + '/static/',
229−)
230−
231−# List of finder classes that know how to find static files in
232−# various locations.
233−STATICFILES_FINDERS = (
234− 'django.contrib.staticfiles.finders.FileSystemFinder',
235− 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
236− # 'django.contrib.staticfiles.finders.DefaultStorageFinder',
237− 'compressor.finders.CompressorFinder',
238−)
239−
240−# Django 1.6+ defaults to a JSON serializer, but it won't work with
241−# django-openid, see
242−# https://bugs.launchpad.net/django-openid-auth/+bug/1252826
243−SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer'
244−
245−
246−LOGIN_URL = 'account_login'
247−LOGIN_REDIRECT_URL = 'hk_root'
248−LOGOUT_URL = 'account_logout'
249−
250−
251−# If you enable internal authentication, this is the address that the emails
252−# will appear to be coming from. Make sure you set a valid domain name,
253−# otherwise the emails may get rejected.
254−# https://docs.djangoproject.com/en/1.8/ref/settings/#default-from-email
255−DEFAULT_FROM_EMAIL = "@SERVER_EMAIL@"
256−
257−# If you enable email reporting for error messages, this is where those emails
258−# will appear to be coming from. Make sure you set a valid domain name,
259−# otherwise the emails may get rejected.
260−# https://docs.djangoproject.com/en/1.8/ref/settings/#std:setting-SERVER_EMAIL
261−SERVER_EMAIL = "@SERVER_EMAIL@"
262−
263−
264−MESSAGE_TAGS = {
265− messages.ERROR: 'danger'
266−}
267−
268−
269−#
270−# Social auth
271−#
272−AUTHENTICATION_BACKENDS = (
273− 'django.contrib.auth.backends.ModelBackend',
274− 'allauth.account.auth_backends.AuthenticationBackend',
275−)
276−
277−# Django Allauth
278−ACCOUNT_AUTHENTICATION_METHOD = "username_email"
279−ACCOUNT_EMAIL_REQUIRED = True
280−ACCOUNT_EMAIL_VERIFICATION = "mandatory"
281−ACCOUNT_DEFAULT_HTTP_PROTOCOL = "https"
282−ACCOUNT_UNIQUE_EMAIL = True
283−
284−SOCIALACCOUNT_PROVIDERS = {
285− 'openid': {
286− 'SERVERS': [
287− dict(id='yahoo',
288− name='Yahoo',
289− openid_url='http://me.yahoo.com'),
290− ],
291− },
292− 'google': {
293− 'SCOPE': ['profile', 'email'],
294− 'AUTH_PARAMS': {'access_type': 'online'},
295− },
296− 'facebook': {
297− 'METHOD': 'oauth2',
298− 'SCOPE': ['email'],
299− 'FIELDS': [
300− 'email',
301− 'name',
302− 'first_name',
303− 'last_name',
304− 'locale',
305− 'timezone',
306− ],
307− 'VERSION': 'v2.4',
308− },
309− 'gitlab': {
310− 'GITLAB_URL': 'https://gitlab.com',
311− 'SCOPE': ['read_user'],
312− },
313−}
314−
315−
316−#
317−# Gravatar
318−# https://github.com/twaddington/django-gravatar
319−#
320−# Gravatar base url.
321−# GRAVATAR_URL = 'http://cdn.libravatar.org/'
322−# Gravatar base secure https url.
323−# GRAVATAR_SECURE_URL = 'https://seccdn.libravatar.org/'
324−# Gravatar size in pixels.
325−# GRAVATAR_DEFAULT_SIZE = '80'
326−# An image url or one of the following: 'mm', 'identicon', 'monsterid',
327−# 'wavatar', 'retro'.
328−# GRAVATAR_DEFAULT_IMAGE = 'mm'
329−# One of the following: 'g', 'pg', 'r', 'x'.
330−# GRAVATAR_DEFAULT_RATING = 'g'
331−# True to use https by default, False for plain http.
332−# GRAVATAR_DEFAULT_SECURE = True
333−
334−# These can be set to override the defaults but are not mandatory:
335−# EMAIL_CONFIRMATION_TEMPLATE = 'postorius/address_confirmation_message.txt'
336−# EMAIL_CONFIRMATION_SUBJECT = 'Confirmation needed'
337−
338−#
339−# django-compressor
340−# https://pypi.python.org/pypi/django_compressor
341−#
342−COMPRESS_PRECOMPILERS = (
343− ('text/x-scss', '/run/current-system/sw/bin/sassc -t compressed {infile} {outfile}'),
344− ('text/x-sass', '/run/current-system/sw/bin/sassc -t compressed {infile} {outfile}'),
345−)
346−# On a production setup, setting COMPRESS_OFFLINE to True will bring a
347−# significant performance improvement, as CSS files will not need to be
348−# recompiled on each requests. It means running an additional "compress"
349−# management command after each code upgrade.
350−# http://django-compressor.readthedocs.io/en/latest/usage/#offline-compression
351−COMPRESS_ENABLED = True
352−COMPRESS_OFFLINE = True
353−
354−# Needed for debug mode
355−# INTERNAL_IPS = ('127.0.0.1',)
356−
357−
358−#
359−# Full-text search engine
360−#
361−HAYSTACK_CONNECTIONS = {
362− 'default': {
363− 'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine',
364− 'PATH': "/var/lib/mailman-web/fulltext_index",
365− # You can also use the Xapian engine, it's faster and more accurate,
366− # but requires another library.
367− # http://django-haystack.readthedocs.io/en/v2.4.1/installing_search_engines.html#xapian
368− # Example configuration for Xapian:
369− #'ENGINE': 'xapian_backend.XapianEngine'
370− },
371−}
372−
373−
374−#
375−# REST framework
376−#
377−REST_FRAMEWORK = {
378− 'PAGE_SIZE': 10,
379− 'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination',
380− 'DEFAULT_FILTER_BACKENDS': (
381− 'rest_framework.filters.OrderingFilter',
382− ),
383−}
384−
385−
386−#
387−# Asynchronous tasks
388−#
389−Q_CLUSTER = {
390− 'timeout': 300,
391− 'save_limit': 100,
392− 'orm': 'default',
393−}
394−
395−
396−# A sample logging configuration. The only tangible logging
397−# performed by this configuration is to send an email to
398−# the site admins on every HTTP 500 error when DEBUG=False.
399−# See http://docs.djangoproject.com/en/dev/topics/logging for
400−# more details on how to customize your logging configuration.
401−LOGGING = {
402− 'version': 1,
403− 'disable_existing_loggers': False,
404− 'filters': {
405− 'require_debug_false': {
406− '()': 'django.utils.log.RequireDebugFalse'
407− }
408− },
409− 'handlers': {
410− 'console': {
411− 'class': 'logging.StreamHandler',
412− 'formatter': 'simple',
413− },
414− 'mail_admins': {
415− 'level': 'ERROR',
416− 'filters': ['require_debug_false'],
417− 'class': 'django.utils.log.AdminEmailHandler'
418− },
419− 'file':{
420− 'level': 'INFO',
421− #'class': 'logging.handlers.RotatingFileHandler',
422− 'class': 'logging.handlers.WatchedFileHandler',
423− 'filename': 'mailman-web.log',
424− 'formatter': 'verbose',
425− },
426− },
427− 'loggers': {
428− 'django': {
429− 'handlers': ['console', 'file'],
430− 'level': 'INFO',
431− },
432− 'django.request': {
433− 'handlers': ['console', 'mail_admins', 'file'],
434− 'level': 'ERROR',
435− 'propagate': True,
436− },
437− 'postorius': {
438− 'handlers': ['console', 'file'],
439− 'level': 'INFO',
440− },
441− 'django': {
442− 'handlers': ['file'],
443− 'level': 'ERROR',
444− 'propagate': True,
445− },
446− 'hyperkitty': {
447− 'handlers': ['file'],
448− 'level': 'DEBUG',
449− 'propagate': True,
450− },
451− },
452− 'formatters': {
453− 'simple': {
454− 'format': '%(levelname)s: %(message)s'
455− },
456− 'verbose': {
457− 'format': '%(levelname)s %(asctime)s %(process)d %(name)s %(message)s'
458− },
459− 'simple': {
460− 'format': '%(levelname)s %(message)s'
461− },
462− },
463− #'root': {
464− # 'handlers': ['file'],
465− # 'level': 'INFO',
466− #},
467−}
468−
469−
470−POSTORIUS_TEMPLATE_BASE_URL = "http://localhost:8000"
471−
472−
473−# Using the cache infrastructure can significantly improve performance on a
474−# production setup. This is an example with a local Memcached server.
475−#CACHES = {
476−# 'default': {
477−# 'BACKEND': 'django.core.cache.backends.memcached.PyLibMCCache',
478−# 'LOCATION': '127.0.0.1:11211',
479−# }
480−#}
481−
482−
483−# When DEBUG is True, don't actually send emails to the SMTP server, just store
484−# them in a directory. This way you won't accidentally spam your mailing-lists
485−# while you're fiddling with the code.
486−if DEBUG == True:
487− EMAIL_BACKEND = 'django.core.mail.backends.filebased.EmailBackend'
488− EMAIL_FILE_PATH = '/tmp/hyperkitty-emails'
489−
490−
491−#
492−# HyperKitty-specific
493−#
494−# Only display mailing-lists from the same virtual host as the webserver
495−FILTER_VHOST = False
496−# Disable singleton locking for Django-Q tasks.
497−HYPERKITTY_DISABLE_SINGLETON_TASKS = False
498−# Maximum time between two task runs with same function and arguments.
499−# This setting is mostly meant for Mailman Developers and should be used
500−# with caution.
501−# Default set to 10mins.
502−HYPERKITTY_TASK_LOCK_TIMEOUT = 10 * 60
503−
504−
505−try:
506− from settings_local import *
507−except ImportError:
508− pass