gpt4 book ai didi

django - ModuleNotFoundError : No module named 'registration'

转载 作者:行者123 更新时间:2023-12-03 23:53:59 24 4
gpt4 key购买 nike

我对 Django 注册有疑问。该软件包已正确安装,但是当我运行 python3.6 manage.py runserver 时,我收到以下错误:
ModuleNotFoundError:没有名为“注册”的模块
我的 Settings.py、Urls.py 和 HTML 模板文件的屏幕截图附在下面:
[在此处输入图片描述][1]
正在执行系统检查...

Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x10df3cb70>

Traceback (most recent call last):
File "/Users/melissamalala/PycharmProjects/moringatribune/venv/lib/python3.6/site-packages/django/utils/autoreload.py", line 227, in wrapper
fn(*args, **kwargs)
File "/Users/melissamalala/PycharmProjects/moringatribune/venv/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 125, in inner_run
self.check(display_num_errors=True)
File "/Users/melissamalala/PycharmProjects/moringatribune/venv/lib/python3.6/site-packages/django/core/management/base.py", line 359, in check
include_deployment_checks=include_deployment_checks,
File "/Users/melissamalala/PycharmProjects/moringatribune/venv/lib/python3.6/site-packages/django/core/management/base.py", line 346, in _run_checks
return checks.run_checks(**kwargs)
File "/Users/melissamalala/PycharmProjects/moringatribune/venv/lib/python3.6/site-packages/django/core/checks/registry.py", line 81, in run_checks
new_errors = check(app_configs=app_configs)
File "/Users/melissamalala/PycharmProjects/moringatribune/venv/lib/python3.6/site-packages/django/core/checks/urls.py", line 16, in check_url_config
return check_resolver(resolver)
File "/Users/melissamalala/PycharmProjects/moringatribune/venv/lib/python3.6/site-packages/django/core/checks/urls.py", line 26, in check_resolver
return check_method()
File "/Users/melissamalala/PycharmProjects/moringatribune/venv/lib/python3.6/site-packages/django/urls/resolvers.py", line 254, in check
for pattern in self.url_patterns:
File "/Users/melissamalala/PycharmProjects/moringatribune/venv/lib/python3.6/site-packages/django/utils/functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/Users/melissamalala/PycharmProjects/moringatribune/venv/lib/python3.6/site-packages/django/urls/resolvers.py", line 405, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/Users/melissamalala/PycharmProjects/moringatribune/venv/lib/python3.6/site-packages/django/utils/functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/Users/melissamalala/PycharmProjects/moringatribune/venv/lib/python3.6/site-packages/django/urls/resolvers.py", line 398, in urlconf_module
return import_module(self.urlconf_name)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
File "/Users/melissamalala/PycharmProjects/moringatribune/tribune/urls.py", line 25, in <module>
url(r'^accounts/', include('registration.backends.simple.urls')),
File "/Users/melissamalala/PycharmProjects/moringatribune/venv/lib/python3.6/site-packages/django/conf/urls/__init__.py", line 50, in include
urlconf_module = import_module(urlconf_module)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 936, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 936, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 936, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 948, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'registration'
^CTraceback (most recent call last):
File "manage.py", line 8, in <module>
from django.core.management import execute_from_command_line
File "/Users/melissamalala/PycharmProjects/moringatribune/venv/lib/python3.6/site-packages/django/core/management/__init__.py", line 13, in <module>
(venv) Melissas-MacBook-Pro:moringatribune melissamalala$ python manage.py runserver
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x10d9da8c8>
Traceback (most recent call last):
File "/Users/melissamalala/PycharmProjects/moringatribune/venv/lib/python3.6/site-packages/django/utils/autoreload.py", line 227, in wrapper
fn(*args, **kwargs)
File "/Users/melissamalala/PycharmProjects/moringatribune/venv/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 117, in inner_run
autoreload.raise_last_exception()
File "/Users/melissamalala/PycharmProjects/moringatribune/venv/lib/python3.6/site-packages/django/utils/autoreload.py", line 250, in raise_last_exception
six.reraise(*_exception)
File "/Users/melissamalala/PycharmProjects/moringatribune/venv/lib/python3.6/site-packages/django/utils/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/Users/melissamalala/PycharmProjects/moringatribune/venv/lib/python3.6/site-packages/django/utils/autoreload.py", line 227, in wrapper
fn(*args, **kwargs)
File "/Users/melissamalala/PycharmProjects/moringatribune/venv/lib/python3.6/site-packages/django/__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Users/melissamalala/PycharmProjects/moringatribune/venv/lib/python3.6/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/Users/melissamalala/PycharmProjects/moringatribune/venv/lib/python3.6/site-packages/django/apps/config.py", line 94, in create
module = import_module(entry)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 948, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'registration'


[1]: /image/pkJQZ.jpg

最佳答案

来自 docs :

Prior to 3.x, django-registration installed a Python module named registration. To avoid silent incompatibilities, and to conform to more recent best practices, django-registration 3.x now installs a module named django_registration. Attempts to import from the registration module will immediately fail with ImportError.

关于django - ModuleNotFoundError : No module named 'registration' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52493688/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com