forked from galaxyproject/ansible-mailman3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.py.example1
113 lines (94 loc) · 3.58 KB
/
settings.py.example1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# -*- coding: utf-8 -*-
# Mailman Web configuration file.
# /etc/mailman3/settings.py
from mailman_web.settings.base import *
from mailman_web.settings.mailman import *
#: Default list of admins who receive the emails from error logging.
ADMINS = (
('__', '__'),
)
# Postgresql database setup.
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'HOST': '__',
'NAME': '__',
'PASSWORD': '__',
'PORT': '5432',
'USER': 'mailman3_web',
}
}
# 'collectstatic' command will copy all the static files here.
# Alias this location from your webserver to `/static`
STATIC_ROOT = '/var/lib/mailman3/web/static'
# enable the 'compress' command.
COMPRESS_ENABLED = True
#: Logging configuration.
del LOGGING['handlers']['file']
LOGGING['handlers']['console']['level'] = 'INFO'
LOGGING['formatters']['simple']['format'] = '%(levelname)s %(name)s %(message)s'
# In case the handler config is updated upstream, we don't want to fully overwrite it, so we just manipulate it
for _logger in LOGGING['loggers'].values():
_handlers = _logger['handlers']
for _handler in ('file', 'mail_admins'):
try:
_handlers.remove(_handler)
except ValueError:
pass
if 'console' not in _handlers:
_logger['handlers'].append('console')
#: Hosts/domain names that are valid for this site; required if DEBUG is False.
#: See https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
ALLOWED_HOSTS = [
"localhost", # Archiving API from Mailman, keep it.
"127.0.0.1",
# Add here all production URLs you may have.
"mailman.example.org",
]
#: See https://docs.djangoproject.com/en/dev/ref/settings/#csrf-trusted-origins
#: For Django <4.0 these are of the form 'lists.example.com' or
#: '.example.com' to include subdomains and for Django >=4.0 they include
#: the scheme as in 'https://lists.example.com' or 'https://*.example.com'.
CSRF_TRUSTED_ORIGINS = [
# "lists.your-domain.org",
# Add here all production domains you have.
"http://mailman.example.org",
"https://mailman.example.org",
]
#: Current Django Site being served. This is used to customize the web host
#: being used to serve the current website. For more details about Django
#: site, see: https://docs.djangoproject.com/en/dev/ref/contrib/sites/
SITE_ID = 1
# Set this to a new secret value.
SECRET_KEY = "__"
# Set this to match the api_key setting in
# /opt/mailman/mm/mailman-hyperkitty.cfg (quoted here, not there).
MAILMAN_ARCHIVER_KEY = '__'
# The sender of emails from Django such as address confirmation requests.
# Set this to a valid email address.
DEFAULT_FROM_EMAIL = 'postorius@mailman.example.org'
# The sender of error messages from Django. Set this to a valid email
# address.
SERVER_EMAIL = 'root@mailman.example.org'
# Mailman API credentials
MAILMAN_REST_API_URL = 'http://localhost:8001'
MAILMAN_REST_API_USER = 'restadmin'
MAILMAN_REST_API_PASS = 'restpass'
#: django-compressor
#: https://pypi.python.org/pypi/django_compressor
COMPRESS_PRECOMPILERS = (
('text/x-scss', 'pysassc -t compressed {infile} {outfile}'),
('text/x-sass', 'pysassc -t compressed {infile} {outfile}'),
)
#
# Full-text search engine
#
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.elasticsearch7_backend.Elasticsearch7SearchEngine',
'URL': 'http://127.0.0.1:9200/',
'INDEX_NAME': 'haystack',
},
}
# Add custom middleware to set REMOTE_ADDR when using a unix domain socket
MIDDLEWARE = MIDDLEWARE + ('ansible_galaxyproject_mailman3_middleware.SetRemoteAddrFromForwardedFor',)