资源管理器中显示的所有文件都存在相同的问题。 我没有注意到这个问题,直到我去进行民意调查迁移并返回错误:
ModuleNotFoundError:没有模块名称“polls.apps.PollsConfigdjango”; polls.apps 不是一个包
我正在做基本的 Django 教程,这是迄今为止我遇到的唯一问题。
I tried changing polls.apps.PollsConfig in the installed apps section to have django at the end (as it is shown in the console error).
I tried changing polls\apps.py to 'from mysite.apps' which shows the same error, as well as 'from polls.apps' which shows a circular error. I did this to see if VSCode would remove the underline showing there was no longer an error. 'from polls.apps' did remove the underline, however when making the migration it showed a circular error in powershell.
I'm figuring on this being a simple beginner error and am hoping someone will know what the issue is at a glance. It wouldn't bother me at all to start this over and do it again but since I clearly made an error and therefor likely didn't understand something it would be very cool to know what that was and possibly gain some insight.
值得一提的是,我使用的是 Windows 11 附带的 powershell 版本,而不是从 VSCode 使用它;我只使用 VSCode 作为浏览器/编写代码。
以下是包含所需信息的图片:
点冻结
民意调查pps.py
回溯
摘自settings.py:
INSTALLED_APPS = [
'polls.apps.PollsConfig'
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]