[mailman3] Add our own urls file

The current deployment doesn't look to work correctly for redirects, this should
fix it.

Signed-off-by: Michal Konecny <mkonecny@redhat.com>
This commit is contained in:
Michal Konecny 2024-03-27 14:35:03 +01:00
parent 3d52a247d8
commit f919603485
4 changed files with 29 additions and 5 deletions

View file

@ -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)),
]

View file

@ -127,7 +127,17 @@
- config - config
- mailman - mailman
notify: 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 - name: Create the fulltext index dir
ansible.builtin.file: ansible.builtin.file:

View file

@ -43,7 +43,7 @@ MAILMAN_REST_API_PASS = '{{ mailman_rest_api_pass }}'
MAILMAN_ARCHIVER_KEY = '{{ mailman_hyperkitty_archiver_key }}' MAILMAN_ARCHIVER_KEY = '{{ mailman_hyperkitty_archiver_key }}'
MAILMAN_ARCHIVER_FROM = ('127.0.0.1', '::1') MAILMAN_ARCHIVER_FROM = ('127.0.0.1', '::1')
ROOT_URLCONF = 'mailman_web.urls' ROOT_URLCONF = 'urls'
# Application definition # Application definition
@ -120,8 +120,6 @@ TEMPLATES = [
}, },
] ]
WSGI_APPLICATION = 'wsgi.application'
# Database # Database
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases # https://docs.djangoproject.com/en/1.8/ref/settings/#databases

View file

@ -20,7 +20,7 @@
# Redirecting to hyperkitty if nothing is specified # Redirecting to hyperkitty if nothing is specified
RewriteEngine on RewriteEngine on
RewriteRule ^/$ /hyperkitty [R,L] RewriteRule ^/$ /archives [R,L]
ProxyPreserveHost On ProxyPreserveHost On
ProxyRequests off ProxyRequests off