mailman3-web and the django middleware problem
Howdy!
I'm trying to migrate an aged mailman3 installation from ubuntu 20.04 to ubuntu 22.04. Fresh install of mailman3-web gives me:
Creating config file /etc/dbconfig-common/mailman3-web.conf with new version creating database mailman3web.db: success. verifying database mailman3web.db exists: success.
Creating config file /etc/mailman3/mailman-web.py with new version /usr/lib/python3/dist-packages/django_q/conf.py:174: UserWarning: Retry and timeout are misconfigured. Set retry larger than t imeout,failure to do so will cause the tasks to be retriggered before completion.See https://django-q2.readthedocs.io/en/maste r/configure.html#retry for details. warn( Traceback (most recent call last): File "/usr/bin/django-admin", line 33, in <module> sys.exit(load_entry_point('Django==4.2.11', 'console_scripts', 'django-admin')()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/django/core/management/__init__.py", line 442, in execute_from_command_line utility.execute() File "/usr/lib/python3/dist-packages/django/core/management/__init__.py", line 416, in execute django.setup() File "/usr/lib/python3/dist-packages/django/__init__.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "/usr/lib/python3/dist-packages/django/apps/registry.py", line 124, in populate app_config.ready() File "/usr/lib/python3/dist-packages/allauth/account/apps.py", line 15, in ready raise ImproperlyConfigured( django.core.exceptions.ImproperlyConfigured: allauth.account.middleware.AccountMiddleware must be added to settings.MIDDLEWARE dpkg: error processing package mailman3-web (--configure): installed mailman3-web package post-installation script subprocess returned error exit status 1 Errors were encountered while processing: mailman3-web needrestart is being skipped since dpkg has failed E: Sub-process /usr/bin/dpkg returned an error code (1)
I've already seen this thread: https://lists.mailman3.org/archives/list/mailman-users@mailman3.org/message/...
...but that does not get me anywhere.
Could someone please push me in the right direction?
cheers! t.
Correction. Not 22.04. I'm trying 24.04.
Am 2024-04-25 13:35, schrieb Thomas Stein:
Howdy!
I'm trying to migrate an aged mailman3 installation from ubuntu 20.04 to ubuntu 22.04. Fresh install of mailman3-web gives me:
Creating config file /etc/dbconfig-common/mailman3-web.conf with new version creating database mailman3web.db: success. verifying database mailman3web.db exists: success.
Creating config file /etc/mailman3/mailman-web.py with new version /usr/lib/python3/dist-packages/django_q/conf.py:174: UserWarning: Retry and timeout are misconfigured. Set retry larger than t imeout,failure to do so will cause the tasks to be retriggered before completion.See https://django-q2.readthedocs.io/en/maste r/configure.html#retry for details. warn( Traceback (most recent call last): File "/usr/bin/django-admin", line 33, in <module> sys.exit(load_entry_point('Django==4.2.11', 'console_scripts', 'django-admin')()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/django/core/management/__init__.py", line 442, in execute_from_command_line utility.execute() File "/usr/lib/python3/dist-packages/django/core/management/__init__.py", line 416, in execute django.setup() File "/usr/lib/python3/dist-packages/django/__init__.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "/usr/lib/python3/dist-packages/django/apps/registry.py", line 124, in populate app_config.ready() File "/usr/lib/python3/dist-packages/allauth/account/apps.py", line 15, in ready raise ImproperlyConfigured( django.core.exceptions.ImproperlyConfigured: allauth.account.middleware.AccountMiddleware must be added to settings.MIDDLEWARE dpkg: error processing package mailman3-web (--configure): installed mailman3-web package post-installation script subprocess returned error exit status 1 Errors were encountered while processing: mailman3-web needrestart is being skipped since dpkg has failed E: Sub-process /usr/bin/dpkg returned an error code (1)
I've already seen this thread: https://lists.mailman3.org/archives/list/mailman-users@mailman3.org/message/...
...but that does not get me anywhere.
Could someone please push me in the right direction?
cheers! t.
Mailman-users mailing list -- mailman-users@mailman3.org To unsubscribe send an email to mailman-users-leave@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/...
This message sent to himbeere@meine-oma.de
On 4/25/24 04:35, Thomas Stein wrote:
Traceback (most recent call last): File "/usr/bin/django-admin", line 33, in <module> sys.exit(load_entry_point('Django==4.2.11', 'console_scripts', 'django-admin')()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/django/core/management/__init__.py", line 442, in execute_from_command_line utility.execute() File "/usr/lib/python3/dist-packages/django/core/management/__init__.py", line 416, in execute django.setup() File "/usr/lib/python3/dist-packages/django/__init__.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "/usr/lib/python3/dist-packages/django/apps/registry.py", line 124, in populate app_config.ready() File "/usr/lib/python3/dist-packages/allauth/account/apps.py", line 15, in ready raise ImproperlyConfigured( django.core.exceptions.ImproperlyConfigured: allauth.account.middleware.AccountMiddleware must be added to settings.MIDDLEWARE
This is a packaging issue in the Debian/Ubuntu package and should be reported to Debian. See the BREAKING CHANGE item in the 1.3.10 section at <https://gitlab.com/mailman/django-mailman3/-/blob/master/README.rst>.
You need to add allauth.account.middleware.AccountMiddleware
to the
MIDDLEWARE setting in your Django settings.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
Am 2024-04-25 19:05, schrieb Mark Sapiro:
On 4/25/24 04:35, Thomas Stein wrote:
Traceback (most recent call last): File "/usr/bin/django-admin", line 33, in <module> sys.exit(load_entry_point('Django==4.2.11', 'console_scripts', 'django-admin')()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/django/core/management/__init__.py", line 442, in execute_from_command_line utility.execute() File "/usr/lib/python3/dist-packages/django/core/management/__init__.py", line 416, in execute django.setup() File "/usr/lib/python3/dist-packages/django/__init__.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "/usr/lib/python3/dist-packages/django/apps/registry.py", line 124, in populate app_config.ready() File "/usr/lib/python3/dist-packages/allauth/account/apps.py", line 15, in ready raise ImproperlyConfigured( django.core.exceptions.ImproperlyConfigured: allauth.account.middleware.AccountMiddleware must be added to settings.MIDDLEWARE
Thanks for you answer.
This is a packaging issue in the Debian/Ubuntu package and should be reported to Debian.
I already did. https://bugs.launchpad.net/ubuntu/+source/mailman-suite/+bug/2062960
See the BREAKING CHANGE item in the 1.3.10 section at <https://gitlab.com/mailman/django-mailman3/-/blob/master/README.rst>.
You need to add
allauth.account.middleware.AccountMiddleware
to the MIDDLEWARE setting in your Django settings.
I'm not sure how to add that to my django settings. Adding:
x = list(MIDDLEWARE) x.insert(0, 'allauth.account.middleware.AccountMiddleware') MIDDLEWARE = x
did not help. Any hints?
thanks again, t.
On 4/25/24 12:34, Thomas Stein wrote:
I'm not sure how to add that to my django settings. Adding:
x = list(MIDDLEWARE) x.insert(0, 'allauth.account.middleware.AccountMiddleware') MIDDLEWARE = x
did not help. Any hints?
I don't know how things are arranged in the Debian/Ubuntu package, but you may have a settings.py which at the end does something like
try:
from settings_local import *
except ImportError:
pass
If that is the case, adding the above snippet to the end of settings_local.py should work.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
Am 2024-04-25 22:03, schrieb Mark Sapiro:
On 4/25/24 12:34, Thomas Stein wrote:
I'm not sure how to add that to my django settings. Adding:
x = list(MIDDLEWARE) x.insert(0, 'allauth.account.middleware.AccountMiddleware') MIDDLEWARE = x
did not help. Any hints?
I don't know how things are arranged in the Debian/Ubuntu package, but you may have a settings.py which at the end does something like
try: from settings_local import * except ImportError: pass
If that is the case, adding the above snippet to the end of settings_local.py should work.
Yes, that's the case. I added the snippet in question to settings_local.py but this leads to another error:
File "/usr/share/mailman3-web/settings.py", line 503, in <module> from settings_local import * File "/usr/share/mailman3-web/settings_local.py", line 194, in <module> x = list(MIDDLEWARE) ^^^^^^^^^^ NameError: name 'MIDDLEWARE' is not defined dpkg: error processing package mailman3-web (--configure):
I hope you can helo again.
cheers, t.
On 4/25/24 14:01, Thomas Stein wrote:
Am 2024-04-25 22:03, schrieb Mark Sapiro:
I don't know how things are arranged in the Debian/Ubuntu package, but you may have a settings.py which at the end does something like
try: from settings_local import * except ImportError: pass
If that is the case, adding the above snippet to the end of settings_local.py should work.
Yes, that's the case. I added the snippet in question to settings_local.py but this leads to another error:
File "/usr/share/mailman3-web/settings.py", line 503, in <module> from settings_local import * File "/usr/share/mailman3-web/settings_local.py", line 194, in <module> x = list(MIDDLEWARE) ^^^^^^^^^^ NameError: name 'MIDDLEWARE' is not defined dpkg: error processing package mailman3-web (--configure):
Yes. I understand. In your case, MIDDLEWARE is only defined in settings.py and not in settings_local.py. As I understand it originally you added
x = list(MIDDLEWARE)
x.insert(0, 'allauth.account.middleware.AccountMiddleware')
MIDDLEWARE = x
to settings.py and you say it didn't help. I don't know why that wouldn't work as long as there is no setting for MIDDLEWARE in settings_local.py and you added that after the MIDDLEWARE setting in settings.py. When you say it didn't help, do you mean you still get the
django.core.exceptions.ImproperlyConfigured: allauth.account.middleware.AccountMiddleware must be added to settings.MIDDLEWARE
message or something else? I note that the original post in this thread
refers to /etc/mailman3/mailman-web.py which is presumably where the
package ultimately puts the Django settings, and I don't know what dpkg --configure
is doing.
One thing you could try is in settings_local.py, put
from settings import MIDDLEWARE
x = list(MIDDLEWARE)
x.insert(0, 'allauth.account.middleware.AccountMiddleware')
MIDDLEWARE = x
to work around the NameError.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
"Mark" == Mark Sapiro <mark@msapiro.net> writes:
Mark> On 4/25/24 14:01, Thomas Stein wrote:
Am 2024-04-25 22:03, schrieb Mark Sapiro:
I don't know how things are arranged in the Debian/Ubuntu package, but you may have a settings.py which at the end does something like
try: from settings_local import * except ImportError: pass
If that is the case, adding the above snippet to the end of settings_local.py should work.
This has been reported to Debian and is fixed upstream in the Debian repositories -- see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1062707
It should hit a sefver soon, as it was uploaded yesterday. I don't know how soon after that it'll hit the Ubuntu repos.
Peter C
Am 2024-04-26 00:52, schrieb Mark Sapiro:
On 4/25/24 14:01, Thomas Stein wrote:
Am 2024-04-25 22:03, schrieb Mark Sapiro:
I don't know how things are arranged in the Debian/Ubuntu package, but you may have a settings.py which at the end does something like
try: from settings_local import * except ImportError: pass
If that is the case, adding the above snippet to the end of settings_local.py should work.
Yes, that's the case. I added the snippet in question to settings_local.py but this leads to another error:
File "/usr/share/mailman3-web/settings.py", line 503, in <module> from settings_local import * File "/usr/share/mailman3-web/settings_local.py", line 194, in <module> x = list(MIDDLEWARE) ^^^^^^^^^^ NameError: name 'MIDDLEWARE' is not defined dpkg: error processing package mailman3-web (--configure):
Yes. I understand. In your case, MIDDLEWARE is only defined in settings.py and not in settings_local.py. As I understand it originally you added
x = list(MIDDLEWARE) x.insert(0, 'allauth.account.middleware.AccountMiddleware') MIDDLEWARE = x
to settings.py and you say it didn't help. I don't know why that wouldn't work as long as there is no setting for MIDDLEWARE in settings_local.py and you added that after the MIDDLEWARE setting in settings.py. When you say it didn't help, do you mean you still get the
django.core.exceptions.ImproperlyConfigured: allauth.account.middleware.AccountMiddleware must be added to settings.MIDDLEWARE
message or something else? I note that the original post in this thread refers to /etc/mailman3/mailman-web.py which is presumably where the package ultimately puts the Django settings, and I don't know what
dpkg --configure
is doing.One thing you could try is in settings_local.py, put
from settings import MIDDLEWARE x = list(MIDDLEWARE) x.insert(0, 'allauth.account.middleware.AccountMiddleware') MIDDLEWARE = x
to work around the NameError.
After that I get:
File "/usr/share/mailman3-web/urls.py", line 20, in <module> from django.conf.urls import include, url ImportError: cannot import name 'url' from 'django.conf.urls' (/usr/lib/python3/dist-packages/django/conf/urls/__init__.py) dpkg: error processing package mailman3-web (--configure): installed mailman3-web package post-installation script subprocess returned error exit status 1 Errors were encountered while processing:
I guess I'll wait for the new package for now.
thanks again! t.
On Fri, Apr 26, 2024 at 8:30 AM Thomas Stein <himbeere@meine-oma.de> wrote:
Am 2024-04-26 00:52, schrieb Mark Sapiro:
On 4/25/24 14:01, Thomas Stein wrote:
Am 2024-04-25 22:03, schrieb Mark Sapiro:
I don't know how things are arranged in the Debian/Ubuntu package, but you may have a settings.py which at the end does something like
try: from settings_local import * except ImportError: pass
If that is the case, adding the above snippet to the end of settings_local.py should work.
Yes, that's the case. I added the snippet in question to settings_local.py but this leads to another error:
File "/usr/share/mailman3-web/settings.py", line 503, in <module> from settings_local import * File "/usr/share/mailman3-web/settings_local.py", line 194, in <module> x = list(MIDDLEWARE) ^^^^^^^^^^ NameError: name 'MIDDLEWARE' is not defined dpkg: error processing package mailman3-web (--configure):
Yes. I understand. In your case, MIDDLEWARE is only defined in settings.py and not in settings_local.py. As I understand it originally you added
x = list(MIDDLEWARE) x.insert(0, 'allauth.account.middleware.AccountMiddleware') MIDDLEWARE = x
to settings.py and you say it didn't help. I don't know why that wouldn't work as long as there is no setting for MIDDLEWARE in settings_local.py and you added that after the MIDDLEWARE setting in settings.py. When you say it didn't help, do you mean you still get the
django.core.exceptions.ImproperlyConfigured: allauth.account.middleware.AccountMiddleware must be added to settings.MIDDLEWARE
message or something else? I note that the original post in this thread refers to /etc/mailman3/mailman-web.py which is presumably where the package ultimately puts the Django settings, and I don't know what
dpkg --configure
is doing.One thing you could try is in settings_local.py, put
from settings import MIDDLEWARE x = list(MIDDLEWARE) x.insert(0, 'allauth.account.middleware.AccountMiddleware') MIDDLEWARE = x
to work around the NameError.
After that I get:
File "/usr/share/mailman3-web/urls.py", line 20, in <module> from django.conf.urls import include, url ImportError: cannot import name 'url' from 'django.conf.urls' (/usr/lib/python3/dist-packages/django/conf/urls/__init__.py) dpkg: error processing package mailman3-web (--configure): installed mailman3-web package post-installation script subprocess returned error exit status 1 Errors were encountered while processing:
I guess I'll wait for the new package for now.
How about adding:
MIDDLEWARE += ('allauth.account.middleware.AccountMiddleware',)
in settings_local.py
And how about you use the virtualenv method <https://docs.mailman3.org/en/latest/install/virtualenv.html> for more peace of mind in the future?
-- Best regards, Odhiambo WASHINGTON, Nairobi,KE +254 7 3200 0004/+254 7 2274 3223 In an Internet failure case, the #1 suspect is a constant: DNS. "Oh, the cruft.", egrep -v '^$|^.*#' ¯\_(ツ)_/¯ :-) [How to ask smart questions: http://www.catb.org/~esr/faqs/smart-questions.html]
Using the virtenv installation method seems to be reasonable, yes. Adding the suggested line i did not try yet.
Thanks!
Am 26. April 2024 10:29:18 MESZ schrieb Odhiambo Washington <odhiambo@gmail.com>:
On Fri, Apr 26, 2024 at 8:30 AM Thomas Stein <himbeere@meine-oma.de> wrote:
Am 2024-04-26 00:52, schrieb Mark Sapiro:
On 4/25/24 14:01, Thomas Stein wrote:
Am 2024-04-25 22:03, schrieb Mark Sapiro:
I don't know how things are arranged in the Debian/Ubuntu package, but you may have a settings.py which at the end does something like
try: from settings_local import * except ImportError: pass
If that is the case, adding the above snippet to the end of settings_local.py should work.
Yes, that's the case. I added the snippet in question to settings_local.py but this leads to another error:
File "/usr/share/mailman3-web/settings.py", line 503, in <module> from settings_local import * File "/usr/share/mailman3-web/settings_local.py", line 194, in <module> x = list(MIDDLEWARE) ^^^^^^^^^^ NameError: name 'MIDDLEWARE' is not defined dpkg: error processing package mailman3-web (--configure):
Yes. I understand. In your case, MIDDLEWARE is only defined in settings.py and not in settings_local.py. As I understand it originally you added
x = list(MIDDLEWARE) x.insert(0, 'allauth.account.middleware.AccountMiddleware') MIDDLEWARE = x
to settings.py and you say it didn't help. I don't know why that wouldn't work as long as there is no setting for MIDDLEWARE in settings_local.py and you added that after the MIDDLEWARE setting in settings.py. When you say it didn't help, do you mean you still get the
django.core.exceptions.ImproperlyConfigured: allauth.account.middleware.AccountMiddleware must be added to settings.MIDDLEWARE
message or something else? I note that the original post in this thread refers to /etc/mailman3/mailman-web.py which is presumably where the package ultimately puts the Django settings, and I don't know what
dpkg --configure
is doing.One thing you could try is in settings_local.py, put
from settings import MIDDLEWARE x = list(MIDDLEWARE) x.insert(0, 'allauth.account.middleware.AccountMiddleware') MIDDLEWARE = x
to work around the NameError.
After that I get:
File "/usr/share/mailman3-web/urls.py", line 20, in <module> from django.conf.urls import include, url ImportError: cannot import name 'url' from 'django.conf.urls' (/usr/lib/python3/dist-packages/django/conf/urls/__init__.py) dpkg: error processing package mailman3-web (--configure): installed mailman3-web package post-installation script subprocess returned error exit status 1 Errors were encountered while processing:
I guess I'll wait for the new package for now.
How about adding:
MIDDLEWARE += ('allauth.account.middleware.AccountMiddleware',)
in settings_local.py
And how about you use the virtualenv method <https://docs.mailman3.org/en/latest/install/virtualenv.html> for more peace of mind in the future?
On 4/25/24 22:30, Thomas Stein wrote:
Am 2024-04-26 00:52, schrieb Mark Sapiro:
One thing you could try is in settings_local.py, put
from settings import MIDDLEWARE x = list(MIDDLEWARE) x.insert(0, 'allauth.account.middleware.AccountMiddleware') MIDDLEWARE = x
to work around the NameError.
After that I get:
File "/usr/share/mailman3-web/urls.py", line 20, in <module> from django.conf.urls import include, url ImportError: cannot import name 'url' from 'django.conf.urls' (/usr/lib/python3/dist-packages/django/conf/urls/__init__.py) dpkg: error processing package mailman3-web (--configure): installed mailman3-web package post-installation script subprocess returned error exit status 1 Errors were encountered while processing:
This is another Debian/Ubuntu packaging issue. The packaged /usr/share/mailman3-web/urls.py is incompatible with Django>=4.1. Replace it with the one at https://gitlab.com/mailman/mailman-web/-/blob/master/mailman_web/urls.py?ref...
I guess I'll wait for the new package for now.
Hopefully that will fix it, or, as Odhiambo suggests, you can uninstall the Debian/Ubuntu packages and install per https://docs.mailman3.org/en/latest/install/virtualenv.html
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
Am 26. April 2024 18:23:56 MESZ schrieb Mark Sapiro <mark@msapiro.net>:
On 4/25/24 22:30, Thomas Stein wrote:
Am 2024-04-26 00:52, schrieb Mark Sapiro:
One thing you could try is in settings_local.py, put
from settings import MIDDLEWARE x = list(MIDDLEWARE) x.insert(0, 'allauth.account.middleware.AccountMiddleware') MIDDLEWARE = x
to work around the NameError.
After that I get:
File "/usr/share/mailman3-web/urls.py", line 20, in <module> from django.conf.urls import include, url ImportError: cannot import name 'url' from 'django.conf.urls' (/usr/lib/python3/dist-packages/django/conf/urls/__init__.py) dpkg: error processing package mailman3-web (--configure): installed mailman3-web package post-installation script subprocess returned error exit status 1 Errors were encountered while processing:
This is another Debian/Ubuntu packaging issue. The packaged /usr/share/mailman3-web/urls.py is incompatible with Django>=4.1. Replace it with the one at https://gitlab.com/mailman/mailman-web/-/blob/master/mailman_web/urls.py?ref...
I guess I'll wait for the new package for now.
Hopefully that will fix it, or, as Odhiambo suggests, you can uninstall the Debian/Ubuntu packages and install per https://docs.mailman3.org/en/latest/install/virtualenv.html
I did that. It went actually quite well. Had to change the owner of the mailman databases with alter table though.
cheers! t.
participants (4)
-
Mark Sapiro
-
Odhiambo Washington
-
peter@chubb.wattle.id.au
-
Thomas Stein