diff --git a/roles/mailman3/files/urls.py b/roles/mailman3/files/urls.py new file mode 100644 index 0000000000..a5122211f6 --- /dev/null +++ b/roles/mailman3/files/urls.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from django.contrib import admin +from django.urls import include, re_path, reverse_lazy +from django.views.generic import RedirectView + +urlpatterns = [ + re_path(r'^$', RedirectView.as_view( + url=reverse_lazy('list_index'), + permanent=True)), + re_path(r'^admin/', include('postorius.urls')), + re_path(r'^archives/', include('hyperkitty.urls')), + re_path(r'', include('django_mailman3.urls')), + re_path(r'^accounts/', include('allauth.urls')), + re_path(r'^django-admin/', include(admin.site.urls)), +] diff --git a/roles/mailman3/tasks/main.yml b/roles/mailman3/tasks/main.yml index 55e9fb4305..594ef2e56a 100644 --- a/roles/mailman3/tasks/main.yml +++ b/roles/mailman3/tasks/main.yml @@ -127,7 +127,17 @@ - config - mailman notify: - - reload apache + - restart mailmanweb + +- name: Install the hyperkitty/postorius urls file + ansible.builtin.file: + src: urls.py + dest: "{{ mailman_webui_confdir }}/urls.py" + tags: + - config + - mailman + notify: + - restart mailmanweb - name: Create the fulltext index dir ansible.builtin.file: diff --git a/roles/mailman3/templates/settings.py.j2 b/roles/mailman3/templates/settings.py.j2 index cfc9951d6d..81f2aeb2a2 100644 --- a/roles/mailman3/templates/settings.py.j2 +++ b/roles/mailman3/templates/settings.py.j2 @@ -43,7 +43,7 @@ MAILMAN_REST_API_PASS = '{{ mailman_rest_api_pass }}' MAILMAN_ARCHIVER_KEY = '{{ mailman_hyperkitty_archiver_key }}' MAILMAN_ARCHIVER_FROM = ('127.0.0.1', '::1') -ROOT_URLCONF = 'mailman_web.urls' +ROOT_URLCONF = 'urls' # Application definition @@ -120,8 +120,6 @@ TEMPLATES = [ }, ] -WSGI_APPLICATION = 'wsgi.application' - # Database # https://docs.djangoproject.com/en/1.8/ref/settings/#databases diff --git a/roles/mailman3/templates/ssl-mailmanweb.conf.j2 b/roles/mailman3/templates/ssl-mailmanweb.conf.j2 index 5ab3a145ed..bba2e3dccb 100644 --- a/roles/mailman3/templates/ssl-mailmanweb.conf.j2 +++ b/roles/mailman3/templates/ssl-mailmanweb.conf.j2 @@ -20,7 +20,7 @@ # Redirecting to hyperkitty if nothing is specified RewriteEngine on - RewriteRule ^/$ /hyperkitty [R,L] + RewriteRule ^/$ /archives [R,L] ProxyPreserveHost On ProxyRequests off