On 7/31/25 17:54, Mark wrote:

Thank you Mark. It's so close. After wrangling your solution a bit it's working a treat on my test server (wrangled solution below) .

When I add it to the production server (same OS, MM installation, etc) I'm getting a "Bad gateway" error page and the log reports ...

...
     raise self.model.DoesNotExist(
django.contrib.sites.models.Site.DoesNotExist: Site matching query does not exist.

That error will occur when settings.py contains

SITE_ID = 0

and the host in the http request is not one of the hosts in the django_site table in the database or in Sites in the Django admin web UI.

Is that possibly the case here? In any case, if the change to /opt/mailman/venv/lib/python3.11/site-packages/django_mailman3/views/user_adapter.py that you report below is the only thing that changed from a working installation, I don't see how that can affect this.

Is there a complete traceback preceding the log snippet you report. If so, what is it?

I cannot for the life of me get my head around that. I suspect it's something to do with what you said  -- "whatever is proxying to Django setting the appropriate HTTP_HOST header." -- which I don't understand.

This is in the configuration of the web server. It should be configured to pass the host of the incoming request to the proxy target in the HTTP_HOST header. In nginx this is `proxy_set_header Host $host;`. In apache it is `ProxyPreserveHost On`, but again the change to user_adapter shouldn't affect this.

Any additional advice gratefully received.


==================================
/opt/mailman/venv/lib/python3.11/site-packages/django_mailman3/views/user_adapter.py
==================================
COMMENT OUT THESE 2 LINES...

#    def is_open_for_signup(self, req):
#        return False

REPLACE WITH THE FOLLOWING...

     def is_open_for_signup(self, req):
      if req.META['HTTP_HOST'] == 'lists.mydomain.com':

I had

        if req.META.HTTP_HOST == 'lists.mydomain.com':

which as you discovered is wrong. What you have is correct.

          return False
      else:
          return True

And here I had

            return super().is_open_for_signup(self, req)

which should return the is_open_for_signup result from allauth.account.adapter.DefaultAccountAdapter but since that result is an unconditional True, what you have is OK too.

--
Mark Sapiro <m...@msapiro.net>        The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan

_______________________________________________
Mailman-users mailing list -- mailman-users@mailman3.org
To unsubscribe send an email to mailman-users-le...@mailman3.org
https://lists.mailman3.org/mailman3/lists/mailman-users.mailman3.org/
Archived at: 
https://lists.mailman3.org/archives/list/mailman-users@mailman3.org/message/P2SJMVTSZFLNMFAJSUWSNVNY7433ZER3/

This message sent to arch...@mail-archive.com

Reply via email to