chrisdev/wagtail-cookiecutter-foundation

Wagalytics Django ImportError

nsomaru opened this issue · 3 comments

Issue
Wagalytics is importing from django.core.urlresolvers which has been removed in Django 2.0+.

Steps to reproduce

  1. Using cookiecutter, select "y" for Wagalytics and complete the prompts
  2. Run any management command (./manage.py migrate in my case)
  3. Traceback as below

Traceback

Traceback (most recent call last):
  File "./manage.py", line 21, in <module>
    execute_from_command_line(sys.argv)
  File "/home/xxxxxx/.virtualenvs/xxxxxx/lib/python3.5/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
    utility.execute()
  File "/home/xxxxxx/.virtualenvs/xxxxxx/lib/python3.5/site-packages/django/core/management/__init__.py", line 365, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/xxxxxx/.virtualenvs/xxxxxx/lib/python3.5/site-packages/django/core/management/base.py", line 288, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/xxxxxx/.virtualenvs/xxxxxx/lib/python3.5/site-packages/django/core/management/base.py", line 332, in execute
    self.check()
  File "/home/xxxxxx/.virtualenvs/xxxxxx/lib/python3.5/site-packages/django/core/management/base.py", line 364, in check
    include_deployment_checks=include_deployment_checks,
  File "/home/xxxxxx/.virtualenvs/xxxxxx/lib/python3.5/site-packages/django/core/management/commands/migrate.py", line 58, in _run_checks
    issues.extend(super()._run_checks(**kwargs))
  File "/home/xxxxxx/.virtualenvs/xxxxxx/lib/python3.5/site-packages/django/core/management/base.py", line 351, in _run_checks
    return checks.run_checks(**kwargs)
  File "/home/xxxxxx/.virtualenvs/xxxxxx/lib/python3.5/site-packages/django/core/checks/registry.py", line 73, in run_checks
    new_errors = check(app_configs=app_configs)
  File "/home/xxxxxx/.virtualenvs/xxxxxx/lib/python3.5/site-packages/django/core/checks/urls.py", line 40, in check_url_namespaces_unique
    all_namespaces = _load_all_namespaces(resolver)
  File "/home/xxxxxx/.virtualenvs/xxxxxx/lib/python3.5/site-packages/django/core/checks/urls.py", line 57, in _load_all_namespaces
    url_patterns = getattr(resolver, 'url_patterns', [])
  File "/home/xxxxxx/.virtualenvs/xxxxxx/lib/python3.5/site-packages/django/utils/functional.py", line 36, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/home/xxxxxx/.virtualenvs/xxxxxx/lib/python3.5/site-packages/django/urls/resolvers.py", line 540, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/home/xxxxxx/.virtualenvs/xxxxxx/lib/python3.5/site-packages/django/utils/functional.py", line 36, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/home/xxxxxx/.virtualenvs/xxxxxx/lib/python3.5/site-packages/django/urls/resolvers.py", line 533, in urlconf_module
    return import_module(self.urlconf_name)
  File "/home/xxxxxx/.virtualenvs/xxxxxx/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 673, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/home/xxxxxx/dev/dags/xxxxxx/xxxxxx/urls.py", line 6, in <module>
    from wagtail.admin import urls as wagtailadmin_urls
  File "/home/xxxxxx/.virtualenvs/xxxxxx/lib/python3.5/site-packages/wagtail/admin/urls/__init__.py", line 13, in <module>
    from wagtail.admin.api import urls as api_urls
  File "/home/xxxxxx/.virtualenvs/xxxxxx/lib/python3.5/site-packages/wagtail/admin/api/urls.py", line 11, in <module>
    for fn in hooks.get_hooks('construct_admin_api'):
  File "/home/xxxxxx/.virtualenvs/xxxxxx/lib/python3.5/site-packages/wagtail/core/hooks.py", line 47, in get_hooks
    search_for_hooks()
  File "/home/xxxxxx/.virtualenvs/xxxxxx/lib/python3.5/site-packages/wagtail/core/hooks.py", line 41, in search_for_hooks
    list(get_app_submodules('wagtail_hooks'))
  File "/home/xxxxxx/.virtualenvs/xxxxxx/lib/python3.5/site-packages/wagtail/utils/apps.py", line 23, in get_app_submodules
    yield name, import_module('%s.%s' % (name, submodule_name))
  File "/home/xxxxxx/.virtualenvs/xxxxxx/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/home/xxxxxx/.virtualenvs/xxxxxx/lib/python3.5/site-packages/wagalytics/wagtail_hooks.py", line 2, in <module>
    from django.core import urlresolvers
ImportError: cannot import name 'urlresolvers'

Things Tried

  • Upgraded Wagalytics to 0.8 (0.7 in current requirements), did not work.

Any reason why this was closed?

@nsomaru sorry closed in error. Reopening

@nsomaru This error has been fixed. I updated wagalytics to 0.8.1