2013-10-01 13:03:30 +00:00
|
|
|
#-*- coding: utf-8 -*-
|
|
|
|
"""
|
|
|
|
Django settings for HyperKitty + Postorius
|
|
|
|
"""
|
|
|
|
|
|
|
|
import os
|
|
|
|
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
|
|
|
|
2015-04-04 20:43:32 +00:00
|
|
|
# SECURITY WARNING: keep the secret key used in production secret!
|
|
|
|
SECRET_KEY = '{{ mailman_hyperkitty_cookie_key }}'
|
|
|
|
|
|
|
|
# SECURITY WARNING: don't run with debug turned on in production!
|
2013-10-01 13:03:30 +00:00
|
|
|
DEBUG = False
|
2015-04-04 20:43:32 +00:00
|
|
|
|
2013-10-01 13:03:30 +00:00
|
|
|
TEMPLATE_DEBUG = DEBUG
|
|
|
|
|
|
|
|
ADMINS = (
|
2014-06-27 07:23:16 +00:00
|
|
|
('HyperKitty Admin', 'abompard@fedoraproject.org'),
|
2013-10-01 13:03:30 +00:00
|
|
|
)
|
|
|
|
|
2015-04-04 20:43:32 +00:00
|
|
|
# Hosts/domain names that are valid for this site; required if DEBUG is False
|
|
|
|
# See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
|
|
|
|
ALLOWED_HOSTS = [
|
2015-06-16 13:14:42 +00:00
|
|
|
"{{ mailman_url }}",
|
2015-04-04 20:43:32 +00:00
|
|
|
".fedoraproject.org",
|
|
|
|
"discuss.arquillian.org",
|
|
|
|
"localhost", # Archiving API from Mailman
|
|
|
|
"127.0.0.1", # HAProxy ping
|
|
|
|
]
|
|
|
|
# And for BrowserID too, see
|
|
|
|
# http://django-browserid.rtfd.org/page/user/settings.html#django.conf.settings.BROWSERID_AUDIENCES
|
|
|
|
BROWSERID_AUDIENCES = [
|
2015-06-16 13:14:42 +00:00
|
|
|
"https://{{ mailman_url }}",
|
2015-04-04 20:43:32 +00:00
|
|
|
]
|
2013-10-01 13:03:30 +00:00
|
|
|
|
|
|
|
# Mailman API credentials
|
|
|
|
MAILMAN_REST_SERVER = MAILMAN_API_URL = 'http://localhost:8001'
|
|
|
|
MAILMAN_API_USER = MAILMAN_USER = 'restadmin'
|
|
|
|
MAILMAN_API_PASS = MAILMAN_PASS = 'restpass'
|
2015-03-13 14:21:42 +00:00
|
|
|
MAILMAN_ARCHIVER_KEY = 'SecretArchiverAPIKey'
|
2015-04-04 20:43:32 +00:00
|
|
|
MAILMAN_ARCHIVER_FROM = ('127.0.0.1', '::1')
|
|
|
|
|
|
|
|
# Application definition
|
|
|
|
|
|
|
|
INSTALLED_APPS = (
|
|
|
|
'django.contrib.auth',
|
|
|
|
'django.contrib.contenttypes',
|
|
|
|
'django.contrib.sessions',
|
|
|
|
#'django.contrib.sites',
|
|
|
|
'django.contrib.messages',
|
|
|
|
'django.contrib.staticfiles',
|
|
|
|
# Uncomment the next line to enable the admin:
|
|
|
|
'django.contrib.admin',
|
|
|
|
# Uncomment the next line to enable admin documentation:
|
|
|
|
# 'django.contrib.admindocs',
|
|
|
|
'hyperkitty',
|
|
|
|
'social.apps.django_app.default',
|
|
|
|
'rest_framework',
|
|
|
|
'django_gravatar',
|
|
|
|
'crispy_forms',
|
|
|
|
'paintstore',
|
|
|
|
'compressor',
|
|
|
|
'django_browserid',
|
|
|
|
'haystack',
|
|
|
|
'django_extensions',
|
|
|
|
'postorius',
|
|
|
|
)
|
|
|
|
import django
|
|
|
|
if django.VERSION[:2] < (1, 7):
|
|
|
|
INSTALLED_APPS = INSTALLED_APPS + ("south",)
|
|
|
|
|
|
|
|
|
|
|
|
MIDDLEWARE_CLASSES = (
|
|
|
|
'django.middleware.common.CommonMiddleware',
|
|
|
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
|
|
|
'django.middleware.csrf.CsrfViewMiddleware',
|
|
|
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
|
|
|
'django.contrib.messages.middleware.MessageMiddleware',
|
|
|
|
# Uncomment the next line for simple clickjacking protection:
|
|
|
|
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
|
|
|
'hyperkitty.middleware.SSLRedirect',
|
|
|
|
'hyperkitty.middleware.TimezoneMiddleware',
|
|
|
|
)
|
|
|
|
|
|
|
|
ROOT_URLCONF = 'urls'
|
2013-10-01 13:03:30 +00:00
|
|
|
|
|
|
|
# CSS theme for postorius
|
|
|
|
MAILMAN_THEME = "default"
|
|
|
|
|
2015-04-04 20:43:32 +00:00
|
|
|
|
|
|
|
# Database
|
|
|
|
# https://docs.djangoproject.com/en/1.6/ref/settings/#databases
|
|
|
|
|
2013-10-01 13:03:30 +00:00
|
|
|
DATABASES = {
|
|
|
|
'default': {
|
|
|
|
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
|
|
|
'NAME': 'hyperkitty',
|
|
|
|
'USER': 'hyperkittyapp',
|
2014-09-18 08:46:01 +00:00
|
|
|
'PASSWORD': '{{ mailman_hyperkitty_db_pass }}',
|
|
|
|
'HOST': '{{ mailman_db_server }}',
|
2013-10-01 13:03:30 +00:00
|
|
|
'PORT': '', # Set to empty string for default.
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# We're behind a proxy, use the X-Forwarded-Host header
|
|
|
|
# See https://docs.djangoproject.com/en/1.5/ref/settings/#use-x-forwarded-host
|
|
|
|
USE_X_FORWARDED_HOST = True
|
2014-06-04 15:52:41 +00:00
|
|
|
# In the Fedora infra, requests are systematically redirected to HTTPS, so put
|
|
|
|
# something always true here:
|
2015-06-16 13:14:42 +00:00
|
|
|
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_SERVER', '{{ mailman_url }}')
|
2014-06-04 15:52:41 +00:00
|
|
|
|
2015-04-04 20:43:32 +00:00
|
|
|
# Internationalization
|
|
|
|
# https://docs.djangoproject.com/en/1.6/topics/i18n/
|
2013-10-01 13:03:30 +00:00
|
|
|
|
|
|
|
LANGUAGE_CODE = 'en-us'
|
|
|
|
|
2015-04-04 20:43:32 +00:00
|
|
|
TIME_ZONE = 'America/Chicago'
|
2013-10-01 13:03:30 +00:00
|
|
|
|
|
|
|
USE_I18N = True
|
|
|
|
|
|
|
|
USE_L10N = True
|
|
|
|
|
|
|
|
USE_TZ = True
|
|
|
|
|
2015-04-04 20:43:32 +00:00
|
|
|
|
|
|
|
# Static files (CSS, JavaScript, Images)
|
|
|
|
# https://docs.djangoproject.com/en/1.6/howto/static-files/
|
|
|
|
|
2013-10-01 13:03:30 +00:00
|
|
|
# Absolute filesystem path to the directory that will hold user-uploaded files.
|
|
|
|
# Example: "/var/www/example.com/media/"
|
|
|
|
MEDIA_ROOT = ''
|
|
|
|
|
|
|
|
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
|
|
|
|
# trailing slash.
|
|
|
|
# Examples: "http://example.com/media/", "http://media.example.com/"
|
|
|
|
MEDIA_URL = ''
|
|
|
|
|
|
|
|
# Absolute path to the directory static files should be collected to.
|
|
|
|
# Don't put anything in this directory yourself; store your static files
|
|
|
|
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
|
|
|
|
# Example: "/var/www/example.com/static/"
|
|
|
|
#STATIC_ROOT = ''
|
|
|
|
STATIC_ROOT = "{{ mailman_webui_basedir }}/static/"
|
|
|
|
|
|
|
|
# URL prefix for static files.
|
|
|
|
# Example: "http://example.com/static/", "http://static.example.com/"
|
|
|
|
STATIC_URL = '/static/'
|
|
|
|
|
|
|
|
# Additional locations of static files
|
|
|
|
STATICFILES_DIRS = (
|
|
|
|
# Put strings here, like "/home/html/static" or "C:/www/django/static".
|
|
|
|
# Always use forward slashes, even on Windows.
|
|
|
|
# Don't forget to use absolute paths, not relative paths.
|
|
|
|
)
|
|
|
|
|
|
|
|
# List of finder classes that know how to find static files in
|
|
|
|
# various locations.
|
|
|
|
STATICFILES_FINDERS = (
|
|
|
|
'django.contrib.staticfiles.finders.FileSystemFinder',
|
|
|
|
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
|
|
|
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
|
2014-09-16 15:01:06 +00:00
|
|
|
'compressor.finders.CompressorFinder',
|
2013-10-01 13:03:30 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
TEMPLATE_CONTEXT_PROCESSORS = (
|
|
|
|
"django.contrib.auth.context_processors.auth",
|
|
|
|
"django.contrib.messages.context_processors.messages",
|
|
|
|
"django.core.context_processors.debug",
|
|
|
|
"django.core.context_processors.i18n",
|
|
|
|
"django.core.context_processors.media",
|
|
|
|
"django.core.context_processors.static",
|
|
|
|
"django.core.context_processors.csrf",
|
|
|
|
"django.core.context_processors.request",
|
|
|
|
"django.core.context_processors.tz",
|
|
|
|
"django.contrib.messages.context_processors.messages",
|
2015-04-04 20:43:32 +00:00
|
|
|
"social.apps.django_app.context_processors.backends",
|
|
|
|
"social.apps.django_app.context_processors.login_redirect",
|
2013-10-01 13:03:30 +00:00
|
|
|
"hyperkitty.context_processors.export_settings",
|
2014-05-23 02:42:47 +00:00
|
|
|
"hyperkitty.context_processors.postorius_info",
|
2013-10-01 13:03:30 +00:00
|
|
|
"postorius.context_processors.postorius",
|
|
|
|
)
|
|
|
|
|
|
|
|
TEMPLATE_DIRS = (
|
|
|
|
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
|
|
|
|
# Always use forward slashes, even on Windows.
|
|
|
|
# Don't forget to use absolute paths, not relative paths.
|
|
|
|
)
|
|
|
|
|
2015-04-04 20:43:32 +00:00
|
|
|
# Django 1.6+ defaults to a JSON serializer, but it won't work with django-openid, see
|
2015-03-13 14:21:42 +00:00
|
|
|
# https://bugs.launchpad.net/django-openid-auth/+bug/1252826
|
|
|
|
SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer'
|
2014-06-03 13:35:38 +00:00
|
|
|
|
2014-05-23 02:42:47 +00:00
|
|
|
|
2015-06-23 08:50:08 +00:00
|
|
|
LOGIN_URL = 'hk_user_login'
|
|
|
|
LOGOUT_URL = 'hk_user_logout'
|
|
|
|
LOGIN_REDIRECT_URL = 'hk_root'
|
2013-10-01 13:03:30 +00:00
|
|
|
|
2014-05-23 02:42:47 +00:00
|
|
|
BROWSERID_USERNAME_ALGO = lambda email: email # Use the email as identifier
|
|
|
|
BROWSERID_VERIFY_CLASS = "django_browserid.views.Verify"
|
2013-10-01 13:03:30 +00:00
|
|
|
|
2015-04-04 20:43:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Social auth
|
|
|
|
#
|
|
|
|
|
|
|
|
AUTHENTICATION_BACKENDS = (
|
|
|
|
#'social.backends.open_id.OpenIdAuth',
|
|
|
|
# http://python-social-auth.readthedocs.org/en/latest/backends/google.html
|
|
|
|
'social.backends.google.GoogleOpenId',
|
|
|
|
#'social.backends.google.GoogleOAuth2',
|
|
|
|
#'social.backends.twitter.TwitterOAuth',
|
|
|
|
'social.backends.yahoo.YahooOpenId',
|
|
|
|
'social.backends.fedora.FedoraOpenId',
|
|
|
|
'django_browserid.auth.BrowserIDBackend',
|
|
|
|
'django.contrib.auth.backends.ModelBackend',
|
|
|
|
)
|
|
|
|
|
|
|
|
# http://python-social-auth.readthedocs.org/en/latest/configuration/django.html#database
|
|
|
|
if django.VERSION[:2] < (1, 7):
|
|
|
|
SOUTH_MIGRATION_MODULES = {
|
|
|
|
'default': 'social.apps.django_app.default.south_migrations'
|
|
|
|
}
|
|
|
|
|
|
|
|
SOCIAL_AUTH_USERNAME_IS_FULL_EMAIL = True
|
|
|
|
|
|
|
|
# http://python-social-auth.readthedocs.org/en/latest/pipeline.html#authentication-pipeline
|
|
|
|
SOCIAL_AUTH_PIPELINE = (
|
|
|
|
'social.pipeline.social_auth.social_details',
|
|
|
|
'social.pipeline.social_auth.social_uid',
|
|
|
|
'social.pipeline.social_auth.auth_allowed',
|
|
|
|
'social.pipeline.social_auth.social_user',
|
|
|
|
'social.pipeline.user.get_username',
|
|
|
|
# Associates the current social details with another user account with
|
|
|
|
# a similar email address. Disabled by default, enable with care:
|
|
|
|
# http://python-social-auth.readthedocs.org/en/latest/use_cases.html#associate-users-by-email
|
|
|
|
'social.pipeline.social_auth.associate_by_email',
|
|
|
|
'social.pipeline.user.create_user',
|
|
|
|
'social.pipeline.social_auth.associate_user',
|
|
|
|
'social.pipeline.social_auth.load_extra_data',
|
|
|
|
'social.pipeline.user.user_details',
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-10-01 13:03:30 +00:00
|
|
|
#
|
|
|
|
# Gravatar
|
|
|
|
# https://github.com/twaddington/django-gravatar
|
|
|
|
#
|
|
|
|
# Gravatar base url.
|
2013-12-18 16:27:24 +00:00
|
|
|
#GRAVATAR_URL = 'http://cdn.libravatar.org/'
|
2013-10-01 13:03:30 +00:00
|
|
|
# Gravatar base secure https url.
|
2013-12-18 16:27:24 +00:00
|
|
|
#GRAVATAR_SECURE_URL = 'https://seccdn.libravatar.org/'
|
2013-10-01 13:03:30 +00:00
|
|
|
# Gravatar size in pixels.
|
|
|
|
#GRAVATAR_DEFAULT_SIZE = '80'
|
|
|
|
# An image url or one of the following: 'mm', 'identicon', 'monsterid', 'wavatar', 'retro'.
|
|
|
|
#GRAVATAR_DEFAULT_IMAGE = 'mm'
|
|
|
|
# One of the following: 'g', 'pg', 'r', 'x'.
|
|
|
|
#GRAVATAR_DEFAULT_RATING = 'g'
|
|
|
|
# True to use https by default, False for plain http.
|
|
|
|
#GRAVATAR_DEFAULT_SECURE = True
|
|
|
|
|
|
|
|
#
|
2014-09-16 15:01:06 +00:00
|
|
|
# django-compressor
|
|
|
|
# https://pypi.python.org/pypi/django_compressor
|
2013-10-01 13:03:30 +00:00
|
|
|
#
|
2014-09-16 15:01:06 +00:00
|
|
|
COMPRESS_PRECOMPILERS = (
|
|
|
|
('text/less', 'lessc {infile} {outfile}'),
|
|
|
|
)
|
2014-09-16 15:10:40 +00:00
|
|
|
COMPRESS_OFFLINE = True
|
2014-09-16 15:01:06 +00:00
|
|
|
# needed for debug mode
|
|
|
|
#INTERNAL_IPS = ('127.0.0.1',)
|
2013-10-01 13:03:30 +00:00
|
|
|
|
2015-04-04 20:43:32 +00:00
|
|
|
# Django Crispy Forms
|
|
|
|
CRISPY_TEMPLATE_PACK = 'bootstrap3'
|
|
|
|
CRISPY_FAIL_SILENTLY = not DEBUG
|
|
|
|
|
2013-10-01 13:03:30 +00:00
|
|
|
|
2015-03-13 14:21:42 +00:00
|
|
|
#
|
|
|
|
# Full-text search engine
|
|
|
|
#
|
|
|
|
HAYSTACK_CONNECTIONS = {
|
|
|
|
'default': {
|
2015-03-13 17:29:45 +00:00
|
|
|
'ENGINE': 'xapian_backend.XapianEngine',
|
2015-03-13 14:21:42 +00:00
|
|
|
'PATH': "{{ mailman_webui_basedir }}/fulltext_index",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-10-01 13:03:30 +00:00
|
|
|
# A sample logging configuration. The only tangible logging
|
|
|
|
# performed by this configuration is to send an email to
|
|
|
|
# the site admins on every HTTP 500 error when DEBUG=False.
|
|
|
|
# See http://docs.djangoproject.com/en/dev/topics/logging for
|
|
|
|
# more details on how to customize your logging configuration.
|
|
|
|
LOGGING = {
|
|
|
|
'version': 1,
|
|
|
|
'disable_existing_loggers': False,
|
|
|
|
'filters': {
|
|
|
|
'require_debug_false': {
|
|
|
|
'()': 'django.utils.log.RequireDebugFalse'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
'handlers': {
|
|
|
|
'mail_admins': {
|
|
|
|
'level': 'ERROR',
|
|
|
|
'filters': ['require_debug_false'],
|
|
|
|
'class': 'django.utils.log.AdminEmailHandler'
|
|
|
|
},
|
|
|
|
'file':{
|
|
|
|
'level': 'INFO',
|
|
|
|
#'class': 'logging.handlers.RotatingFileHandler',
|
2013-12-06 16:51:05 +00:00
|
|
|
'class': 'logging.handlers.WatchedFileHandler',
|
2013-10-01 13:03:30 +00:00
|
|
|
'filename': '/var/log/hyperkitty/hyperkitty.log',
|
|
|
|
'formatter': 'verbose',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'loggers': {
|
2014-06-27 07:23:16 +00:00
|
|
|
'django.request': {
|
|
|
|
'handlers': ['mail_admins'],
|
|
|
|
'level': 'ERROR',
|
|
|
|
'propagate': True,
|
|
|
|
},
|
2013-10-01 13:03:30 +00:00
|
|
|
'django.request': {
|
|
|
|
'handlers': ['file'],
|
|
|
|
'level': 'ERROR',
|
|
|
|
'propagate': True,
|
|
|
|
},
|
|
|
|
'django': {
|
|
|
|
'handlers': ['file'],
|
|
|
|
'level': 'ERROR',
|
|
|
|
'propagate': True,
|
|
|
|
},
|
|
|
|
'hyperkitty': {
|
|
|
|
'handlers': ['file'],
|
|
|
|
'level': 'DEBUG',
|
|
|
|
'propagate': True,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'formatters': {
|
|
|
|
'verbose': {
|
|
|
|
'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
|
|
|
|
},
|
|
|
|
'simple': {
|
|
|
|
'format': '%(levelname)s %(message)s'
|
|
|
|
},
|
|
|
|
},
|
2014-06-04 15:52:41 +00:00
|
|
|
'root': {
|
|
|
|
'handlers': ['file'],
|
|
|
|
'level': 'INFO',
|
|
|
|
},
|
2013-10-01 13:03:30 +00:00
|
|
|
}
|
|
|
|
|
2013-12-06 16:56:38 +00:00
|
|
|
|
|
|
|
# Cache: use the local memcached server
|
|
|
|
CACHES = {
|
|
|
|
'default': {
|
|
|
|
'BACKEND': 'django.core.cache.backends.memcached.PyLibMCCache',
|
|
|
|
'LOCATION': '127.0.0.1:11211',
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-10-01 13:03:30 +00:00
|
|
|
|
2015-04-04 20:43:32 +00:00
|
|
|
#
|
|
|
|
# HyperKitty-specific
|
|
|
|
#
|
|
|
|
|
2013-10-01 13:03:30 +00:00
|
|
|
APP_NAME = 'Fedora list archives'
|
|
|
|
|
|
|
|
# Allow authentication with the internal user database?
|
|
|
|
# By default, only a login through Persona or your email provider is allowed.
|
|
|
|
USE_INTERNAL_AUTH = False
|
|
|
|
|
|
|
|
# Use SSL when logged in
|
2015-03-13 14:21:42 +00:00
|
|
|
USE_SSL = True
|
2013-10-01 13:03:30 +00:00
|
|
|
|
2013-12-18 16:27:24 +00:00
|
|
|
# Only display mailing-lists from the same virtual host as the webserver
|
|
|
|
FILTER_VHOST = False
|
|
|
|
|
2013-10-01 13:03:30 +00:00
|
|
|
# This is for development purposes
|
|
|
|
USE_MOCKUPS = False
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
from settings_local import *
|
|
|
|
except ImportError:
|
|
|
|
pass
|