I'm a Python beginner.I am proceeding with Django's tutorial, but when I call pols in IDLE, I get the following error:
>>from polls.models import Question, Choice
Traceback (most recent call last):
File "<pyshell#13>", line 1, in <module>
from polls.models import Question, Choice
ModuleNotFoundError: No module named 'polls'
What we did was change INSTALLED_APPS
in mysite/urls.py
as follows:
INSTALLED_APPS=[
'polls.apps.PollsConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
The command line (?) also did the following:
python manage.py makemigrations polls
python manage.py sqlmigrate polls0001
python manage.py migrate
What is the cause of the error?
python django
Maybe it's because the Django version is old. This error occurs if the Django version is older than 1.9. python manage.py --version
can verify the Django version.
Note: ImportError: No module named'polls.apps.PollsConfig' --Django tickets#27139
© 2024 OneMinuteCode. All rights reserved.