我在我的机器上的virtualenvwrapper中运行了w。所有要求都按需安装
Django>=2.0,<2.1
wagtail>=2.0,<2.1
我甚至通过完全卸载django和wagtail来重新开始这个过程。重新安装wagtail之后,我运行wagtail start mysite
,cd进入我的目录并运行python manage.py migrate
。这就是我所看到的:
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'
我没有添加任何自定义代码..这是一个从头开始的安装。导致此错误的原因是什么?
答案 0 :(得分:3)
事实证明,djangorestframework是旧版本。这绝对不是建议的问题的重复,但我能够通过升级我的版本来解决它(由@Alexy建议)。如果其他人有类似的问题,我会把它留下来。