[GH-ISSUE #3108] manage.py migrate fails with 2.2.2 #1769

Closed
opened 2026-02-27 11:19:00 +03:00 by kerem · 2 comments
Owner

Originally created by @s256 on GitHub (Oct 26, 2023).
Original GitHub issue: https://github.com/modoboa/modoboa/issues/3108

Impacted versions

  • OS Type: Debian
  • OS Version: Bookworm
  • Database Type: PostgreSQL
  • Database version: 15
  • Modoboa: 2.2.2
  • installer used: No
  • Webserver: Nginx

Steps to reproduce

Create a new virtual environment and install all packages e.g. pip install -U modoboa-webmail modoboa-sievefilters modoboa-radicale modoboa-postfix-autoreply modoboa-pdfcredentials modoboa-contacts modoboa-amavis modoboa==2.2.2 psycopg[binary]>=3.1

and run python manage.py migrate after switching into the virtual environment e.g. source .venv/bin/activate
(You can also keep the virtualenv and update the packages in there, same result)

Fix the urls.py file to:
cat instance/urls.py

from django.urls import include, path

urlpatterns = [
   path(r'', include('modoboa.urls')),
]

Current behavior

python manage.py migrate
Traceback (most recent call last):
File "/srv/modoboa/instance/manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "/srv/modoboa/.venv-python11/lib/python3.11/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
utility.execute()
File "/srv/modoboa/.venv-python11/lib/python3.11/site-packages/django/core/management/__init__.py", line 416, in execute
django.setup()
File "/srv/modoboa/.venv-python11/lib/python3.11/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/srv/modoboa/.venv-python11/lib/python3.11/site-packages/django/apps/registry.py", line 124, in populate
app_config.ready()
File "/srv/modoboa/.venv-python11/lib/python3.11/site-packages/modoboa_pdfcredentials/apps.py", line 13, in ready
from . import handlers
File "/srv/modoboa/.venv-python11/lib/python3.11/site-packages/modoboa_pdfcredentials/handlers.py", line 8, in <module>
from django.utils.translation import ugettext as _
ImportError: cannot import name 'ugettext' from 'django.utils.translation' (/srv/modoboa/.venv-python11/lib/python3.11/site-packages/django/utils/translation/__init__.py)

Expected behavior

an actual migration

Comment

I followed the general instructions, which should be updated, IMHO, in other github issues it was mentioned to update the extensions BEFORE modoboa, so the official docs should reflect that. I then followed the specific instructions https://modoboa.readthedocs.io/en/latest/upgrade.html#id2. Coming from 2.1.2.

Originally created by @s256 on GitHub (Oct 26, 2023). Original GitHub issue: https://github.com/modoboa/modoboa/issues/3108 # Impacted versions * OS Type: Debian * OS Version: Bookworm * Database Type: PostgreSQL * Database version: 15 * Modoboa: 2.2.2 * installer used: No * Webserver: Nginx # Steps to reproduce Create a new virtual environment and install all packages e.g. `pip install -U modoboa-webmail modoboa-sievefilters modoboa-radicale modoboa-postfix-autoreply modoboa-pdfcredentials modoboa-contacts modoboa-amavis modoboa==2.2.2 psycopg[binary]>=3.1` and run `python manage.py migrate` after switching into the virtual environment e.g. `source .venv/bin/activate` (You can also keep the virtualenv and update the packages in there, same result) Fix the `urls.py` file to: `cat instance/urls.py` ``` from django.urls import include, path urlpatterns = [ path(r'', include('modoboa.urls')), ] ``` # Current behavior ``` python manage.py migrate Traceback (most recent call last): File "/srv/modoboa/instance/manage.py", line 22, in <module> execute_from_command_line(sys.argv) File "/srv/modoboa/.venv-python11/lib/python3.11/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line utility.execute() File "/srv/modoboa/.venv-python11/lib/python3.11/site-packages/django/core/management/__init__.py", line 416, in execute django.setup() File "/srv/modoboa/.venv-python11/lib/python3.11/site-packages/django/__init__.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "/srv/modoboa/.venv-python11/lib/python3.11/site-packages/django/apps/registry.py", line 124, in populate app_config.ready() File "/srv/modoboa/.venv-python11/lib/python3.11/site-packages/modoboa_pdfcredentials/apps.py", line 13, in ready from . import handlers File "/srv/modoboa/.venv-python11/lib/python3.11/site-packages/modoboa_pdfcredentials/handlers.py", line 8, in <module> from django.utils.translation import ugettext as _ ImportError: cannot import name 'ugettext' from 'django.utils.translation' (/srv/modoboa/.venv-python11/lib/python3.11/site-packages/django/utils/translation/__init__.py) ``` # Expected behavior an actual migration # Comment I followed the general instructions, which should be updated, IMHO, in other github issues it was mentioned to update the extensions BEFORE `modoboa`, so the official docs should reflect that. I then followed the specific instructions https://modoboa.readthedocs.io/en/latest/upgrade.html#id2. Coming from `2.1.2`.
kerem closed this issue 2026-02-27 11:19:01 +03:00
Author
Owner

@Spitfireap commented on GitHub (Oct 26, 2023):

Hi,

You still have modoboa_pdfcredentials installed which has been archived and should be removed from your settings.py file as per the upgrade instruction for 2.1.0.

<!-- gh-comment-id:1781210119 --> @Spitfireap commented on GitHub (Oct 26, 2023): Hi, You still have modoboa_pdfcredentials installed which has been archived and [should be removed from your settings.py file as per the upgrade instruction for 2.1.0](https://modoboa.readthedocs.io/en/latest/upgrade.html#id3).
Author
Owner

@s256 commented on GitHub (Oct 26, 2023):

That was it. Thank you.

<!-- gh-comment-id:1781218314 --> @s256 commented on GitHub (Oct 26, 2023): That was it. Thank you.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/modoboa-modoboa#1769
No description provided.