[GH-ISSUE #3091] Error in migrate after upgrade to 2.2.1 #1761

Closed
opened 2026-02-27 11:18:58 +03:00 by kerem · 3 comments
Owner

Originally created by @jgfoster on GitHub (Oct 13, 2023).
Original GitHub issue: https://github.com/modoboa/modoboa/issues/3091

$ python manage.py migrate
Traceback (most recent call last):
  File "/srv/modoboa/instance/manage.py", line 22, in <module>
    main()
  File "/srv/modoboa/instance/manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/srv/modoboa/env/lib/python3.10/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/srv/modoboa/env/lib/python3.10/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/srv/modoboa/env/lib/python3.10/site-packages/django/core/management/base.py", line 412, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/srv/modoboa/env/lib/python3.10/site-packages/django/core/management/base.py", line 458, in execute
    output = self.handle(*args, **options)
  File "/srv/modoboa/env/lib/python3.10/site-packages/django/core/management/base.py", line 106, in wrapper
    res = handle_func(*args, **kwargs)
  File "/srv/modoboa/env/lib/python3.10/site-packages/django/core/management/commands/migrate.py", line 100, in handle
    self.check(databases=[database])
  File "/srv/modoboa/env/lib/python3.10/site-packages/django/core/management/base.py", line 485, in check
    all_issues = checks.run_checks(
  File "/srv/modoboa/env/lib/python3.10/site-packages/django/core/checks/registry.py", line 88, in run_checks
    new_errors = check(app_configs=app_configs, databases=databases)
  File "/srv/modoboa/env/lib/python3.10/site-packages/django/core/checks/urls.py", line 14, in check_url_config
    return check_resolver(resolver)
  File "/srv/modoboa/env/lib/python3.10/site-packages/django/core/checks/urls.py", line 24, in check_resolver
    return check_method()
  File "/srv/modoboa/env/lib/python3.10/site-packages/django/urls/resolvers.py", line 494, in check
    for pattern in self.url_patterns:
  File "/srv/modoboa/env/lib/python3.10/site-packages/django/utils/functional.py", line 57, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/srv/modoboa/env/lib/python3.10/site-packages/django/urls/resolvers.py", line 715, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/srv/modoboa/env/lib/python3.10/site-packages/django/utils/functional.py", line 57, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/srv/modoboa/env/lib/python3.10/site-packages/django/urls/resolvers.py", line 708, in urlconf_module
    return import_module(self.urlconf_name)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/srv/modoboa/instance/instance/urls.py", line 1, in <module>
    from django.conf.urls import include, url
ImportError: cannot import name 'url' from 'django.conf.urls' (/srv/modoboa/env/lib/python3.10/site-packages/django/conf/urls/__init__.py)

When I upgraded Modoboa before the extensions (per the instructions), I got the error in #3074. When I attempted the "fix" of installing extensions first, I got the above error. Fortunately, I was able to revert Modoboa to 2.1.2 and things appear to be working. Following is my list of extensions.

Name Installed version Last version Description
Modoboa 2.1.2 2.2.0 The core part of Modoboa
Amavis frontend 1.4.1 1.5.0 Simple amavis management frontend
Contacts 0.9.3 1.0.0 Address book
Postfix autoreply 1.7.1 1.8.0 Auto-reply (vacation) functionality using Postfix
Radicale management 1.6.3 1.7.0 Management frontend for Radicale, a simple calendar and contact server.
Sieve filters 1.6.0 1.7.0 Plugin to easily create server-side filters
Webmail 1.7.2 1.8.0 Simple IMAP webmail
Originally created by @jgfoster on GitHub (Oct 13, 2023). Original GitHub issue: https://github.com/modoboa/modoboa/issues/3091 ```shell $ python manage.py migrate Traceback (most recent call last): File "/srv/modoboa/instance/manage.py", line 22, in <module> main() File "/srv/modoboa/instance/manage.py", line 18, in main execute_from_command_line(sys.argv) File "/srv/modoboa/env/lib/python3.10/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line utility.execute() File "/srv/modoboa/env/lib/python3.10/site-packages/django/core/management/__init__.py", line 436, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/srv/modoboa/env/lib/python3.10/site-packages/django/core/management/base.py", line 412, in run_from_argv self.execute(*args, **cmd_options) File "/srv/modoboa/env/lib/python3.10/site-packages/django/core/management/base.py", line 458, in execute output = self.handle(*args, **options) File "/srv/modoboa/env/lib/python3.10/site-packages/django/core/management/base.py", line 106, in wrapper res = handle_func(*args, **kwargs) File "/srv/modoboa/env/lib/python3.10/site-packages/django/core/management/commands/migrate.py", line 100, in handle self.check(databases=[database]) File "/srv/modoboa/env/lib/python3.10/site-packages/django/core/management/base.py", line 485, in check all_issues = checks.run_checks( File "/srv/modoboa/env/lib/python3.10/site-packages/django/core/checks/registry.py", line 88, in run_checks new_errors = check(app_configs=app_configs, databases=databases) File "/srv/modoboa/env/lib/python3.10/site-packages/django/core/checks/urls.py", line 14, in check_url_config return check_resolver(resolver) File "/srv/modoboa/env/lib/python3.10/site-packages/django/core/checks/urls.py", line 24, in check_resolver return check_method() File "/srv/modoboa/env/lib/python3.10/site-packages/django/urls/resolvers.py", line 494, in check for pattern in self.url_patterns: File "/srv/modoboa/env/lib/python3.10/site-packages/django/utils/functional.py", line 57, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "/srv/modoboa/env/lib/python3.10/site-packages/django/urls/resolvers.py", line 715, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "/srv/modoboa/env/lib/python3.10/site-packages/django/utils/functional.py", line 57, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "/srv/modoboa/env/lib/python3.10/site-packages/django/urls/resolvers.py", line 708, in urlconf_module return import_module(self.urlconf_name) File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1050, in _gcd_import File "<frozen importlib._bootstrap>", line 1027, in _find_and_load File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 688, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 883, in exec_module File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed File "/srv/modoboa/instance/instance/urls.py", line 1, in <module> from django.conf.urls import include, url ImportError: cannot import name 'url' from 'django.conf.urls' (/srv/modoboa/env/lib/python3.10/site-packages/django/conf/urls/__init__.py) ``` When I upgraded Modoboa before the extensions (per the [instructions](https://modoboa.readthedocs.io/en/latest/upgrade.html)), I got the error in #3074. When I attempted the "fix" of installing extensions first, I got the above error. Fortunately, I was able to revert Modoboa to 2.1.2 and things appear to be working. Following is my list of extensions. Name | Installed version | Last version | Description -- | -- | -- | -- Modoboa | 2.1.2 | 2.2.0 | The core part of Modoboa Amavis frontend | 1.4.1 | 1.5.0 | Simple amavis management frontend Contacts | 0.9.3 | 1.0.0 | Address book Postfix autoreply | 1.7.1 | 1.8.0 | Auto-reply (vacation) functionality using Postfix Radicale management | 1.6.3 | 1.7.0 | Management frontend for Radicale, a simple calendar and contact server. Sieve filters | 1.6.0 | 1.7.0 | Plugin to easily create server-side filters Webmail | 1.7.2 | 1.8.0 | Simple IMAP webmail
kerem 2026-02-27 11:18:58 +03:00
Author
Owner

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

  File "/srv/modoboa/instance/instance/urls.py", line 1, in <module>
    from django.conf.urls import include, url

Please follow the upgrade instruction for 2.2.0.

<!-- gh-comment-id:1763323154 --> @Spitfireap commented on GitHub (Oct 15, 2023): > ```shell > File "/srv/modoboa/instance/instance/urls.py", line 1, in <module> > from django.conf.urls import include, url > ``` Please follow the [upgrade instruction](https://modoboa.readthedocs.io/en/latest/upgrade.html#id2) for 2.2.0.
Author
Owner

@jgfoster commented on GitHub (Oct 15, 2023):

upgrade instructions:

In every case, you will need to apply the general procedure first and then check if the version you are installing requires specific actions.

Just to confirm, we are supposed to do the specific actions before applying the general procedures?

<!-- gh-comment-id:1763429178 --> @jgfoster commented on GitHub (Oct 15, 2023): [upgrade instructions](https://modoboa.readthedocs.io/en/latest/upgrade.html#specific-upgrade-instructions): > In every case, you will need to apply the general procedure first and then check if the version you are installing requires specific actions. Just to confirm, we are supposed to do the specific actions before applying the general procedures?
Author
Owner

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

Oh right, should be the other way around usually :)

<!-- gh-comment-id:1763972280 --> @Spitfireap commented on GitHub (Oct 16, 2023): Oh right, should be the other way around usually :)
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#1761
No description provided.