On Sat, Dec 24, 2022 at 9:40 PM Mark Sapiro <mark@msapiro.net> wrote:
On 12/24/22 00:00, Odhiambo Washington wrote:
These are my files:
- urls.py <CUT > from django.conf.urls import include from django.urls import re_path from django.contrib import admin from django.urls import 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'^postorius/', include('postorius.urls')), re_path(r'^hyperkitty/', include('hyperkitty.urls')), re_path(r'', include('django_mailman3.urls')), re_path(r'^accounts/', include('allauth.urls')), # Django admin re_path(r'^admin/', admin.site.urls), re_path(r'^mailman3/', include('postorius.urls')), re_path(r'^archives/', include('hyperkitty.urls')), ] </CUT>
You don't need all of those. ^postorius/ and ^mailman3/ are two different ways to access Postorius, and ^hyperkitty/ and ^archives/ are two different ways to access HypereKitty. You only need one of each, but having both is OK.
That urls.py was picked from https://wiki.list.org/DOC/Mailman%203%20installation%20experience. Maybe that page needs some edits/revision now?
- apache.conf
<CUT> ... Alias /static "/opt/mailman/mm/static" <Directory "/opt/mailman/mm/static"> Require all granted </Directory> # WSGIScriptAlias /mailman3 /opt/mailman/mm/wsgi.py # WSGIScriptAlias /accounts /opt/mailman/mm/wsgi.py # WSGIScriptAlias /admin /opt/mailman/mm/wsgi.py # WSGIScriptAlias /archives /opt/mailman/mm/wsgi.py # WSGIScriptAlias /user-profile /opt/mailman/mm/wsgi.py # WSGIScriptAlias /hyperkitty /opt/mailman/mm/wsgi.py # WSGIScriptAlias /postorius /opt/mailman/mm/wsgi.py WSGIScriptAlias / /opt/mailman/mm/wsgi.py
This will send every http request to mod_wsgi except for requests to /static. This is OK if there are no other web sites on this server and the only http requests are for Django related things.
This is just a virtual host. There are other websites on the server.
...
I have tested with creating all those commented out aliases and that ended up still giving me /mailman3/mailman3/* which I did not like, although everything appeared to work. I then ended up with only "WSGIScriptAlias / /opt/mailman/mm/wsgi.py" and now when I type https://mm3-lists.kictanet.or.ke I end up at https://mm3-lists.kictanet.or.ke/mailman3/lists/. Of course something has appended "/mailman3" So this has resulted in all URLs having /mailman3/ appended, except for the /archives link.
How about https://mm3-lists.kictanet.or.ke/user_profile/ ?
I have uncommented the line "WSGIScriptAlias /user-profile /opt/mailman/mm/wsgi.py", I don't see any definition for it in urls.py as well. Perhaps that's the issue?
When I uncomment /user-profile, I end up with an ugly URL: https://mm3-lists.kictanet.or.ke/user-profile/user-profile/
So instead of aliasing the /user-profile, I have decided to add another definition to urls.py: re_path(r'^user-profile/', include('allauth.urls')), Which I think gives me a cleaner URL: https://mm3-lists.kictanet.or.ke/user-profile/login/?next=/user-profile/
I also had to alias /accounts, which then brings me to: https://mm3-lists.kictanet.or.ke/accounts/mailman3/lists/ - which I believe is fine because one gets the option to either login or signup.
And I think that "/account" and "/user-profile" are synonymous.
Now my question is about what could be adding the /mailman3. Is it possible
that I installed something out of the ordinary?
It's a mod_wsgi thing. I haven't used mod_wsgi for Mailman for some time (I now use gunicorn on all the sites I manage), but when I did I think I had
WSGIScriptAlias /mm3 /opt/mailman/mm/wsgi.py
and all the URLs were like https://example.com/mm3/mailman3/..., https://example.com/mm3/archives/..., etc.
I already had gunicorn working too, but I just need to also figure out this mod_wsgi. I will stop bothering about the /mailman3 being appended, as long as it serves the required purpose.
Thank you for all the help.
-- Best regards, Odhiambo WASHINGTON, Nairobi,KE +254 7 3200 0004/+254 7 2274 3223 "Oh, the cruft.", egrep -v '^$|^.*#' ¯\_(ツ)_/¯ :-)