我知道我是在一个小时前问的这个问题,但它是复制的。不过,我已经尝试了另一个问题中建议的解决方案,包括升级我的django、更改模型和utils.py
#from
from django.core import urlresolvers
#to
from django.urls import reverse
但是,当我尝试运行management .py runserver时,仍然得到“无法导入名称urlresolvers”的错误。 这是完全错误
Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\threading.py", line 926, in _bootstrap_inne
r
self.run()
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\django\utils\autoreload.py",
line 54, in wrapper
fn(*args, **kwargs)
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\comman
ds\runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\django\utils\autoreload.py",
line 77, in raise_last_exception
raise _exception[1]
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\__init
__.py", line 337, in execute
autoreload.check_errors(django.setup)()
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\django\utils\autoreload.py",
line 54, in wrapper
fn(*args, **kwargs)
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\django\__init__.py", line 24,
in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\django\apps\registry.py", lin
e 114, in populate
app_config.import_models()
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\django\apps\config.py", line
211, in import_models
self.models_module = import_module(models_module_name)
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\importlib\__init__.py", line 127, in import
_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\allauth\account\models.py", l
ine 17, in <module>
from .utils import user_email
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\allauth\account\utils.py", li
ne 30, in <module>
from ..utils import (import_callable, valid_email_or_none,
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\allauth\utils.py", line 8, in
<module>
from django.core import urlresolvers
ImportError: cannot import name 'urlresolvers' from 'django.core' (C:\Users\User\AppData\Local\Programs\Pyth
on\Python37\lib\site-packages\django\core\__init__.py)
只是重申一下——我已经尝试了这里建议的解决方案——> ImportError:没有名为“django.core.urlresolvers”的模块 问题来源StackOverflow 地址:/questions/59379706/getting-cannot-import-name-urlresolvers-error-when-running-manage-py
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。