1 # -*- coding: utf-8 -*-
2 # Copyright (C) 1998-2018 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)
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
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/>.
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/
29 # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
32 BASE_DIR
= os
.path
.dirname(os
.path
.abspath(__file__
))
35 # Quick-start development settings - unsuitable for production
36 # See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
38 # SECURITY WARNING: keep the secret key used in production secret!
39 SECRET_KEY
= '$!-7^wl#wiifjbh)5@f7ji%x!vp7s1vzbvwt26hxv$idixq0u0'
41 # SECURITY WARNING: don't run with debug turned on in production!
45 #('Admin', 'webmaster@example.com'),
52 # Mailman API credentials
53 MAILMAN_REST_API_URL
= 'http://localhost:8001'
54 MAILMAN_REST_API_USER
= 'restadmin'
55 MAILMAN_REST_API_PASS
= 'restpass'
58 # Application definition
61 'django.contrib.admin',
62 'django.contrib.auth',
63 'django.contrib.contenttypes',
64 'django.contrib.sessions',
65 'django.contrib.sites',
66 'django.contrib.messages',
67 'django.contrib.staticfiles',
73 'allauth.socialaccount',
74 'allauth.socialaccount.providers.openid',
75 'django_mailman3.lib.auth.fedora',
76 'allauth.socialaccount.providers.github',
77 'allauth.socialaccount.providers.gitlab',
78 'allauth.socialaccount.providers.google',
79 # 'allauth.socialaccount.providers.facebook',
80 'allauth.socialaccount.providers.twitter',
81 'allauth.socialaccount.providers.stackexchange',
86 'django.contrib.sessions.middleware.SessionMiddleware',
87 'django.middleware.common.CommonMiddleware',
88 'django.middleware.csrf.CsrfViewMiddleware',
89 'django.middleware.locale.LocaleMiddleware',
90 'django.contrib.auth.middleware.AuthenticationMiddleware',
91 'django.contrib.messages.middleware.MessageMiddleware',
92 'django.middleware.clickjacking.XFrameOptionsMiddleware',
93 'django.middleware.security.SecurityMiddleware',
94 'postorius.middleware.PostoriusMiddleware',
97 # Set `postorius.urls` as main url config if Postorius
98 # is the only app you want to serve.
104 'BACKEND': 'django.template.backends.django.DjangoTemplates',
108 'context_processors': [
109 'django.template.context_processors.debug',
110 'django.template.context_processors.i18n',
111 'django.template.context_processors.media',
112 'django.template.context_processors.static',
113 'django.template.context_processors.tz',
114 'django.template.context_processors.csrf',
115 'django.template.context_processors.request',
116 'django.contrib.auth.context_processors.auth',
117 'django.contrib.messages.context_processors.messages',
118 'django_mailman3.context_processors.common',
119 'postorius.context_processors.postorius',
125 WSGI_APPLICATION
= 'wsgi.application'
129 # https://docs.djangoproject.com/en/1.9/ref/settings/#databases
133 'ENGINE': 'django.db.backends.sqlite3',
134 'NAME': os
.path
.join(BASE_DIR
, 'postorius.db'),
138 # Password validation
139 # https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators
141 AUTH_PASSWORD_VALIDATORS
= [
143 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
146 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
149 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
152 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
156 # Internationalization
157 # https://docs.djangoproject.com/en/1.9/topics/i18n/
159 LANGUAGE_CODE
= 'en-us'
170 # Static files (CSS, JavaScript, Images)
171 # https://docs.djangoproject.com/en/1.9/howto/static-files/
174 # Absolute path to the directory static files should be collected to.
175 # Don't put anything in this directory yourself; store your static files
176 # in apps' "static/" subdirectories and in STATICFILES_DIRS.
177 # Example: "/var/www/example.com/static/"
178 STATIC_ROOT
= os
.path
.join(BASE_DIR
, 'static')
180 # URL prefix for static files.
181 # Example: "http://example.com/static/", "http://static.example.com/"
182 STATIC_URL
= '/static/'
184 LOGIN_URL
= 'account_login'
185 LOGIN_REDIRECT_URL
= 'list_index'
186 LOGOUT_URL
= 'account_logout'
190 # From Address for emails sent to users
191 DEFAULT_FROM_EMAIL
= 'postorius@localhost.local'
192 # From Address for emails sent to admins
193 SERVER_EMAIL
= 'root@localhost.local'
194 # Compatibility with Bootstrap 3
195 from django
.contrib
.messages
import constants
as messages
197 messages
.ERROR
: 'danger'
201 AUTHENTICATION_BACKENDS
= (
202 'django.contrib.auth.backends.ModelBackend',
203 'allauth.account.auth_backends.AuthenticationBackend',
207 ACCOUNT_AUTHENTICATION_METHOD
= "username_email"
208 ACCOUNT_EMAIL_REQUIRED
= True
209 ACCOUNT_EMAIL_VERIFICATION
= "mandatory"
210 ACCOUNT_DEFAULT_HTTP_PROTOCOL
= "https"
211 ACCOUNT_UNIQUE_EMAIL
= True
213 SOCIALACCOUNT_PROVIDERS
= {
218 openid_url
='http://me.yahoo.com'),
222 'SCOPE': ['profile', 'email'],
223 'AUTH_PARAMS': {'access_type': 'online'},
242 # These can be set to override the defaults but are not mandatory:
243 # EMAIL_CONFIRMATION_TEMPLATE = 'postorius/address_confirmation_message.txt'
244 # EMAIL_CONFIRMATION_SUBJECT = 'Confirmation needed'
249 'disable_existing_loggers': False,
252 'class': 'logging.StreamHandler',
253 'formatter': 'simple',
257 #'class': 'logging.handlers.RotatingFileHandler',
258 'class': 'logging.handlers.WatchedFileHandler',
259 'filename': os
.path
.join(BASE_DIR
, 'logs', 'postorius.log'),
260 'formatter': 'verbose',
265 'handlers': ['console', 'file'],
269 'handlers': ['console', 'file'],
273 'handlers': ['console', 'file'],
279 'format': '%(levelname)s: %(message)s'
282 'format': '%(levelname)s %(asctime)s %(process)d %(name)s %(message)s'
289 from settings_local
import *