On Sun, Dec 25, 2022 at 9:05 PM Mark Sapiro <mark@msapiro.net> wrote:
On 12/25/22 01:14, Odhiambo Washington wrote:
On Sat, Dec 24, 2022 at 9:40 PM Mark Sapiro <mark@msapiro.net> wrote:
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?
It is defined in django_mailman3/urls.py which is referenced by
re_path(r'', include('django_mailman3.urls')),
I have seen that now.
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/
It shouldn't include
allauth.urls
. That URL is appropriate if you aren't logged in, but what do you get when you are?Go to https://lists.mailman3.org/user-profile/ and log in if necessary and you'll see what it should look like.
Here when I log in. I land on the /archives ( https://lists.mailman3.org/archives/?sort=popular). I then head to the dropdown and click "Account " and I am taken to https://lists.mailman3.org/user-profile/ (very clean URL!) and that's the same thing I am seeing on my server at the moment..
When I comment out the edit I had on /etc/mailman3/urls.py and uncomment to /user-profile alias in the VHOST, I end up with
- https://mm3-lists.kictanet.or.ke/user-profile/mailman3/lists/ - once I am logged in
- https://mm3-lists.kictanet.or.ke/user-profile/user-profile/ - when I click on "Account " # I hope you can see the duplication of /user-profile, which is ugly.
However, your server isn't using mod_wsgi, I believe, so I shouldn't be comparing it to mine. I just don't like the extra URLs being added.
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.
They are in your instance because of
re_path(r'^user-profile/', include('allauth.urls')),
but they should not be.
I have changed that, as already pointed out, but with consequences :) There must be a way to not have "/user-profile/user-profile"
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.
Why? Intellectual curiosity or do you have an actual need.
It's out of intellectual curiosity actually.
The bottom line is with mod_wsgi, whatever you have in your
WSGIScriptAlias is going to be prepended to the URL path. If you don't want anything prepended, you need
WSGIScriptAlias / /opt/mailman/mm/wsgi.py
but then in order for user-profile to work, you need to replace
re_path(r'', include('django_mailman3.urls')),
in urls.py with the urlpatterns from django_mailman3/urls.py
re_path(r'^user-profile/delete$', delete_account, name='mm_user_account_delete'), re_path(r'^user-profile/$', user_profile, name='mm_user_profile'),
and also add
from django_mailman3.views.profile import delete_account, user_profile
to the imports in urls.py
And with that, I am now happy with what I am seeing.
Again, thank you very much.
-- Best regards, Odhiambo WASHINGTON, Nairobi,KE +254 7 3200 0004/+254 7 2274 3223 "Oh, the cruft.", egrep -v '^$|^.*#' ¯\_(ツ)_/¯ :-)