ModuleNotFoundError: Нет модуля с именем 'captcha.fields'
При выполнении команды python manage.py runserver
в терминале vscode возникла эта ошибка :
Watching for file changes with StatReloader
Performing system checks...
Exception in thread django-main-thread:
Traceback (most recent call last):
File "C:\Users\<user>\AppData\Local\Programs\Python\Python312\Lib\threading.py", line 1073, in _bootstrap_inner
self.run()
File "C:\Users\<user>\AppData\Local\Programs\Python\Python312\Lib\threading.py", line 1010, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\<user>\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "C:\Users\<user>\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\core\management\commands\runserver.py", line 133, in inner_run
self.check(display_num_errors=True)
File "C:\Users\<user>\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\core\management\base.py", line 486, in check
all_issues = checks.run_checks(
^^^^^^^^^^^^^^^^^^
......
File "<frozen importlib._bootstrap_external>", line 995, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "D:\<project path>\porsline\urls.py", line 10, in <module>
path('', include('survey.urls')),
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\<user>\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\urls\conf.py", line 39, in include
urlconf_module = import_module(urlconf_module)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\<user>\AppData\Local\Programs\Python\Python312\Lib\importlib\__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 995, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "D:\<project path>\survey\urls.py", line 2, in <module>
from . import views
File "D:\<project path>\survey\views.py", line 14, in <module>
from . forms import CreateSurveyForm, CreateQuestionForm, ShowSurveyForm
File "D:\<project path>\survey\forms.py", line 11, in <module>
from captcha.fields import CaptchaField
ModuleNotFoundError: No module named 'captcha.fields'
Согласно последней строке верхнего сообщения ModuleNotFoundError: No module named 'captcha.fields'
, я выполнил команды pip3 install django-simple-captcha
и pip3 install django-recaptcha
, но проблема не решена.
Есть ли решение для этой проблемы? Пожалуйста, помогите мне.
Заметка : Я увидел Отсутствие модуля с названием 'captcha.fields', но моя проблема не решена!
Добавили ли вы captcha в INSTALLED_APPS в файле settings.py?
А потом мигрировать?
https://django-simple-captcha.readthedocs.io/en/latest/usage.html