Commit c7363333 authored by Aurélien Bompard's avatar Aurélien Bompard

Use Django-mailman3

parent ba17763f
......@@ -24,8 +24,7 @@ Requirements
============
Postorius requires Python 2.7 or newer and mailmanclient,
the official Python bindings for GNU Mailman, it also requires
django-browserid.
the official Python bindings for GNU Mailman.
The minimum Django version is 1.8.
Postorius needs a running version of GNU Mailman version 3.
......
......@@ -39,12 +39,14 @@ BASE_DIR = os.path.dirname(os.path.abspath(__file__))
SECRET_KEY = '$!-7^wl#wiifjbh)5@f7ji%x!vp7s1vzbvwt26hxv$idixq0u0'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
DEBUG = False
ADMINS = (
#('Admin', 'webmaster@example.com'),
)
SITE_ID = 1
ALLOWED_HOSTS = []
# Mailman API credentials
......@@ -60,13 +62,24 @@ INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'postorius',
'django_mailman3',
'django_browserid',
'allauth',
'allauth.account',
'allauth.socialaccount',
'allauth.socialaccount.providers.openid',
'allauth.socialaccount.providers.github',
'allauth.socialaccount.providers.gitlab',
'allauth.socialaccount.providers.google',
#'allauth.socialaccount.providers.facebook',
'allauth.socialaccount.providers.twitter',
'allauth.socialaccount.providers.stackexchange',
)
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
......@@ -84,6 +97,7 @@ MIDDLEWARE_CLASSES = (
# is the only app you want to serve.
ROOT_URLCONF = 'urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
......@@ -165,18 +179,16 @@ STATIC_ROOT = os.path.join(BASE_DIR, 'static')
# Example: "http://example.com/static/", "http://static.example.com/"
STATIC_URL = '/static/'
LOGIN_URL = 'user_login'
LOGIN_URL = 'account_login'
LOGIN_REDIRECT_URL = 'list_index'
LOGOUT_URL = 'user_logout'
LOGOUT_URL = 'account_logout'
# Use the email username as identifier, but truncate it because
# the User.username field is only 30 chars long.
def username(email):
return email.rsplit('@', 1)[0][:30]
BROWSERID_USERNAME_ALGO = username
# From Address for emails sent to users
DEFAULT_FROM_EMAIL = 'postorius@localhost.local'
# From Address for emails sent to admins
SERVER_EMAIL = 'root@localhost.local'
# Compatibility with Bootstrap 3
from django.contrib.messages import constants as messages
MESSAGE_TAGS = {
......@@ -185,15 +197,45 @@ MESSAGE_TAGS = {
AUTHENTICATION_BACKENDS = (
'django_browserid.auth.BrowserIDBackend',
'django.contrib.auth.backends.ModelBackend',
'allauth.account.auth_backends.AuthenticationBackend',
)
# Django Allauth
ACCOUNT_AUTHENTICATION_METHOD = "username_email"
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_EMAIL_VERIFICATION = "mandatory"
ACCOUNT_DEFAULT_HTTP_PROTOCOL = "https"
ACCOUNT_UNIQUE_EMAIL = True
SOCIALACCOUNT_PROVIDERS = {
'openid': {
'SERVERS': [
dict(id='yahoo',
name='Yahoo',
openid_url='http://me.yahoo.com'),
],
},
'google': {
'SCOPE': ['profile', 'email'],
'AUTH_PARAMS': {'access_type': 'online'},
},
'facebook': {
'METHOD': 'oauth2',
'SCOPE': ['email'],
'FIELDS': [
'email',
'name',
'first_name',
'last_name',
'locale',
'timezone',
],
'VERSION': 'v2.4',
},
}
# From Address for emails sent to users
DEFAULT_FROM_EMAIL = 'postorius@localhost.local'
# From Address for emails sent to admins
SERVER_EMAIL = 'root@localhost.local'
# These can be set to override the defaults but are not mandatory:
# EMAIL_CONFIRMATION_TEMPLATE = 'postorius/address_confirmation_message.txt'
......@@ -218,9 +260,5 @@ LOGGING = {
'handlers': ['console'],
'level': 'INFO',
},
'django_browserid': {
'handlers': ['console'],
'level': 'INFO',
},
},
}
......@@ -18,15 +18,17 @@
from django.conf.urls import include, url
from django.contrib import admin
admin.autodiscover()
from postorius.views import list as list_views
from django.core.urlresolvers import reverse_lazy
from django.views.generic import RedirectView
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url('', include('django_browserid.urls')),
url(r'^$', list_views.list_index),
url(r'^$', RedirectView.as_view(
url=reverse_lazy('postorius.views.list.list_index'),
permanent=True)),
url(r'^postorius/', include('postorius.urls')),
#url(r'^hyperkitty/', include('hyperkitty.urls')),
url(r'^accounts/', include('allauth.urls')),
# Django admin
url(r'^admin/', include(admin.site.urls)),
]
......@@ -37,7 +37,6 @@ setup(
'Django>=1.8',
'Django<1.10',
'django-mailman3',
'django-browserid',
'mailmanclient',
],
)
......@@ -43,7 +43,6 @@ commands =
[testenv:pep8]
basepython = python2.7
deps =
{[base]deps}
flake8
commands =
flake8 {posargs}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment