Add support to see subscription requests pending user confirmation.
[mailman-postorious.git] / example_project / settings.py
blob9827a4d16708dd25ec47b461e1033f018787787e
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 1998-2019 by the Free Software Foundation, Inc.
4 # This file is part of Postorius.
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.
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.
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/>.
19 """
20 Django settings for postorius project.
22 For more information on this file, see
23 https://docs.djangoproject.com/en/1.9/topics/settings/
25 For the full list of settings and their values, see
26 https://docs.djangoproject.com/en/1.9/ref/settings/
27 """
29 # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
30 import os
32 # Compatibility with Bootstrap 3
33 from django.contrib.messages import constants as messages
36 BASE_DIR = os.path.dirname(os.path.abspath(__file__))
39 # Quick-start development settings - unsuitable for production
40 # See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
42 # SECURITY WARNING: keep the secret key used in production secret!
43 SECRET_KEY = '$!-7^wl#wiifjbh)5@f7ji%x!vp7s1vzbvwt26hxv$idixq0u0'
45 # SECURITY WARNING: don't run with debug turned on in production!
46 DEBUG = True
48 ADMINS = (
49 #('Admin', 'webmaster@example.com'),
52 SITE_ID = 1
54 ALLOWED_HOSTS = []
56 # Mailman API credentials
57 MAILMAN_REST_API_URL = 'http://localhost:8001'
58 MAILMAN_REST_API_USER = 'restadmin'
59 MAILMAN_REST_API_PASS = 'restpass'
62 # Application definition
64 INSTALLED_APPS = (
65 'django.contrib.admin',
66 'django.contrib.auth',
67 'django.contrib.contenttypes',
68 'django.contrib.sessions',
69 'django.contrib.sites',
70 'django.contrib.messages',
71 'django.contrib.staticfiles',
72 'postorius',
73 'django_mailman3',
74 'django_gravatar',
75 'allauth',
76 'allauth.account',
77 'allauth.socialaccount',
78 'allauth.socialaccount.providers.openid',
79 'django_mailman3.lib.auth.fedora',
80 'allauth.socialaccount.providers.github',
81 'allauth.socialaccount.providers.gitlab',
82 'allauth.socialaccount.providers.google',
83 # 'allauth.socialaccount.providers.facebook',
84 'allauth.socialaccount.providers.twitter',
85 'allauth.socialaccount.providers.stackexchange',
89 MIDDLEWARE = (
90 'django.contrib.sessions.middleware.SessionMiddleware',
91 'django.middleware.common.CommonMiddleware',
92 'django.middleware.csrf.CsrfViewMiddleware',
93 'django.middleware.locale.LocaleMiddleware',
94 'django.contrib.auth.middleware.AuthenticationMiddleware',
95 'django.contrib.messages.middleware.MessageMiddleware',
96 'django.middleware.clickjacking.XFrameOptionsMiddleware',
97 'django.middleware.security.SecurityMiddleware',
98 'postorius.middleware.PostoriusMiddleware',
101 # Set `postorius.urls` as main url config if Postorius
102 # is the only app you want to serve.
103 ROOT_URLCONF = 'urls'
106 TEMPLATES = [
108 'BACKEND': 'django.template.backends.django.DjangoTemplates',
109 'DIRS': [],
110 'APP_DIRS': True,
111 'OPTIONS': {
112 'context_processors': [
113 'django.template.context_processors.debug',
114 'django.template.context_processors.i18n',
115 'django.template.context_processors.media',
116 'django.template.context_processors.static',
117 'django.template.context_processors.tz',
118 'django.template.context_processors.csrf',
119 'django.template.context_processors.request',
120 'django.contrib.auth.context_processors.auth',
121 'django.contrib.messages.context_processors.messages',
122 'django_mailman3.context_processors.common',
123 'postorius.context_processors.postorius',
129 WSGI_APPLICATION = 'wsgi.application'
132 # Database
133 # https://docs.djangoproject.com/en/1.9/ref/settings/#databases
135 DATABASES = {
136 'default': {
137 'ENGINE': 'django.db.backends.sqlite3',
138 'NAME': os.path.join(BASE_DIR, 'postorius.db'),
142 # Password validation
143 # https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators
145 AUTH_PASSWORD_VALIDATORS = [
147 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
150 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
153 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
156 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
160 # Internationalization
161 # https://docs.djangoproject.com/en/1.9/topics/i18n/
163 LANGUAGE_CODE = 'en-us'
165 TIME_ZONE = 'UTC'
167 USE_I18N = True
169 USE_L10N = True
171 USE_TZ = True
174 # Static files (CSS, JavaScript, Images)
175 # https://docs.djangoproject.com/en/1.9/howto/static-files/
178 # Absolute path to the directory static files should be collected to.
179 # Don't put anything in this directory yourself; store your static files
180 # in apps' "static/" subdirectories and in STATICFILES_DIRS.
181 # Example: "/var/www/example.com/static/"
182 STATIC_ROOT = os.path.join(BASE_DIR, 'static')
184 # URL prefix for static files.
185 # Example: "http://example.com/static/", "http://static.example.com/"
186 STATIC_URL = '/static/'
188 LOGIN_URL = 'account_login'
189 LOGIN_REDIRECT_URL = 'list_index'
190 LOGOUT_URL = 'account_logout'
194 # From Address for emails sent to users
195 DEFAULT_FROM_EMAIL = 'postorius@localhost.local'
196 # From Address for emails sent to admins
197 SERVER_EMAIL = 'root@localhost.local'
198 MESSAGE_TAGS = {
199 messages.ERROR: 'danger'
203 AUTHENTICATION_BACKENDS = (
204 'django.contrib.auth.backends.ModelBackend',
205 'allauth.account.auth_backends.AuthenticationBackend',
208 # Django Allauth
209 ACCOUNT_AUTHENTICATION_METHOD = "username_email"
210 ACCOUNT_EMAIL_REQUIRED = True
211 ACCOUNT_EMAIL_VERIFICATION = "mandatory"
212 ACCOUNT_DEFAULT_HTTP_PROTOCOL = "https"
213 ACCOUNT_UNIQUE_EMAIL = True
215 SOCIALACCOUNT_PROVIDERS = {
216 'openid': {
217 'SERVERS': [
218 dict(id='yahoo',
219 name='Yahoo',
220 openid_url='http://me.yahoo.com'),
223 'google': {
224 'SCOPE': ['profile', 'email'],
225 'AUTH_PARAMS': {'access_type': 'online'},
227 'facebook': {
228 'METHOD': 'oauth2',
229 'SCOPE': ['email'],
230 'FIELDS': [
231 'email',
232 'name',
233 'first_name',
234 'last_name',
235 'locale',
236 'timezone',
238 'VERSION': 'v2.4',
244 # These can be set to override the defaults but are not mandatory:
245 # EMAIL_CONFIRMATION_TEMPLATE = 'postorius/address_confirmation_message.txt'
246 # EMAIL_CONFIRMATION_SUBJECT = 'Confirmation needed'
249 LOGGING = {
250 'version': 1,
251 'disable_existing_loggers': False,
252 'handlers': {
253 'console': {
254 'class': 'logging.StreamHandler',
255 'formatter': 'simple',
257 'file':{
258 'level': 'INFO',
259 #'class': 'logging.handlers.RotatingFileHandler',
260 'class': 'logging.handlers.WatchedFileHandler',
261 'filename': os.path.join(BASE_DIR, 'logs', 'postorius.log'),
262 'formatter': 'verbose',
265 'loggers': {
266 'django': {
267 'handlers': ['console', 'file'],
268 'level': 'INFO',
270 'django.request': {
271 'handlers': ['console', 'file'],
272 'level': 'ERROR',
274 'postorius': {
275 'handlers': ['console', 'file'],
276 'level': 'INFO',
279 'formatters': {
280 'simple': {
281 'format': '%(levelname)s: %(message)s'
283 'verbose': {
284 'format': '%(levelname)s %(asctime)s %(process)d %(name)s %(message)s'
290 POSTORIUS_TEMPLATE_BASE_URL = "http://localhost:8000"
293 try:
294 from settings_local import *
295 except ImportError:
296 pass