0

I'm running wagtail in a virtualenvwrapper on my machine. The requirements all install as needed

Django>=2.0,<2.1
wagtail>=2.0,<2.1

I've even started this process over again by completely uninstalling django and wagtail. After reinstall wagtail, I run wagtail start mysite, cd into my directory and run python manage.py migrate. This is what I see:

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/johnbriggs/.virtualenvs/wagtail/lib/python3.6/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
    utility.execute()
  File "/Users/johnbriggs/.virtualenvs/wagtail/lib/python3.6/site-packages/django/core/management/__init__.py", line 365, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/johnbriggs/.virtualenvs/wagtail/lib/python3.6/site-packages/django/core/management/base.py", line 288, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/Users/johnbriggs/.virtualenvs/wagtail/lib/python3.6/site-packages/django/core/management/base.py", line 332, in execute
    self.check()
  File "/Users/johnbriggs/.virtualenvs/wagtail/lib/python3.6/site-packages/django/core/management/base.py", line 364, in check
    include_deployment_checks=include_deployment_checks,
  File "/Users/johnbriggs/.virtualenvs/wagtail/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 58, in _run_checks
    issues.extend(super()._run_checks(**kwargs))
  File "/Users/johnbriggs/.virtualenvs/wagtail/lib/python3.6/site-packages/django/core/management/base.py", line 351, in _run_checks
    return checks.run_checks(**kwargs)
  File "/Users/johnbriggs/.virtualenvs/wagtail/lib/python3.6/site-packages/django/core/checks/registry.py", line 73, in run_checks
    new_errors = check(app_configs=app_configs)
  File "/Users/johnbriggs/.virtualenvs/wagtail/lib/python3.6/site-packages/django/core/checks/urls.py", line 40, in check_url_namespaces_unique
    all_namespaces = _load_all_namespaces(resolver)
  File "/Users/johnbriggs/.virtualenvs/wagtail/lib/python3.6/site-packages/django/core/checks/urls.py", line 57, in _load_all_namespaces
    url_patterns = getattr(resolver, 'url_patterns', [])
  File "/Users/johnbriggs/.virtualenvs/wagtail/lib/python3.6/site-packages/django/utils/functional.py", line 36, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/Users/johnbriggs/.virtualenvs/wagtail/lib/python3.6/site-packages/django/urls/resolvers.py", line 536, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/Users/johnbriggs/.virtualenvs/wagtail/lib/python3.6/site-packages/django/utils/functional.py", line 36, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/Users/johnbriggs/.virtualenvs/wagtail/lib/python3.6/site-packages/django/urls/resolvers.py", line 529, in urlconf_module
    return import_module(self.urlconf_name)
  File "/Users/johnbriggs/.virtualenvs/wagtail/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/johnbriggs/Sites/wagtail/farts/farts/urls.py", line 5, in <module>
    from wagtail.admin import urls as wagtailadmin_urls
  File "/Users/johnbriggs/.virtualenvs/wagtail/lib/python3.6/site-packages/wagtail/admin/urls/__init__.py", line 13, in <module>
    from wagtail.admin.api import urls as api_urls
  File "/Users/johnbriggs/.virtualenvs/wagtail/lib/python3.6/site-packages/wagtail/admin/api/urls.py", line 6, in <module>
    from .endpoints import PagesAdminAPIEndpoint
  File "/Users/johnbriggs/.virtualenvs/wagtail/lib/python3.6/site-packages/wagtail/admin/api/endpoints.py", line 3, in <module>
    from wagtail.api.v2.endpoints import PagesAPIEndpoint
  File "/Users/johnbriggs/.virtualenvs/wagtail/lib/python3.6/site-packages/wagtail/api/v2/endpoints.py", line 9, in <module>
    from rest_framework.renderers import BrowsableAPIRenderer, JSONRenderer
  File "/Users/johnbriggs/.virtualenvs/wagtail/lib/python3.6/site-packages/rest_framework/renderers.py", line 25, in <module>
    from rest_framework import VERSION, exceptions, serializers, status
  File "/Users/johnbriggs/.virtualenvs/wagtail/lib/python3.6/site-packages/rest_framework/exceptions.py", line 17, in <module>
    from rest_framework.utils.serializer_helpers import ReturnDict, ReturnList
  File "/Users/johnbriggs/.virtualenvs/wagtail/lib/python3.6/site-packages/rest_framework/utils/serializer_helpers.py", line 9, in <module>
    from rest_framework.compat import unicode_to_repr
  File "/Users/johnbriggs/.virtualenvs/wagtail/lib/python3.6/site-packages/rest_framework/compat.py", line 26, in <module>
    from django.core.urlresolvers import (  # Will be removed in Django 2.0
ModuleNotFoundError: No module named 'django.core.urlresolvers'

I haven't added in any custom code.. this is a from-the-start installation. What is causing this error?

brunam
  • 825
  • 2
  • 14
  • 26
  • Did you try to use `wagtail updatemodulepaths` command: http://docs.wagtail.io/en/v2.0/releases/2.0.html#wagtail-module-path-updates? – Alexey Mar 12 '18 at 18:56
  • That fixed that initial error and created a ton more haha... I'll update my post. – brunam Mar 12 '18 at 19:01
  • 1
    Check this https://stackoverflow.com/questions/43139081/importerror-no-module-named-django-core-urlresolvers – Alexey Mar 12 '18 at 19:07
  • Not getting very far updating my urls.py to work with the newer Django. This is a fresh install of everything so I'm really confused why Wagtail would be installing urlpatterns based off of django 1.11 instead of the current path syntax – brunam Mar 12 '18 at 19:14
  • It's definitely not a duplicate. I've looked through the solution and a search for `django.core.urlresolvers` returns nothing. – brunam Mar 12 '18 at 19:27
  • what is your drf version? I think you should `pip install -U djangorestframework` – Alexey Mar 12 '18 at 19:41

1 Answers1

3

It turns out that djangorestframework was an older version. It was most definitely not a duplicate of the question suggested but I was able to solve it by upgrading my version (as suggested by @Alexy). I'm leaving this up in case someone else has a similar issue.

brunam
  • 825
  • 2
  • 14
  • 26
  • I've run into this on several upgrades, and this is exactly what I did - uninstall and reinstall DRF and it was golden. DRF isn't forced to an upgrade, since Wagtail 2.0 still also runs on Django 1.13. – FlipperPA Mar 16 '18 at 15:18