gpt4 book ai didi

python - 错误 : App 'polls' could not be found. 是否在 INSTALLED_APPS 中? *但是 polls 在 settings.py 的 INSTALLED_APPS 中。我

转载 作者:行者123 更新时间:2023-11-28 19:31:18 26 4
gpt4 key购买 nike

我正在尝试创建我的 Django 项目/网站的“投票”部分,教程 (https://docs.djangoproject.com/en/1.8/intro/tutorial01/) 说在我们“激活”模型之前,我们必须在设置的 INSTALLED_APPS 库中包含“投票”。 py。我这样做了,然后我做了 --> $ python manage.py make migrations polls。这给了我错误--> 找不到应用程序“民意调查”。它在 INSTALLED_APPS 中吗?我从这里做什么?我在添加投票后同步了我的数据库,但仍然无法正常工作。

172-16-22-166:mysite manuelgomez$ cd
172-16-22-166:~ manuelgomez$ cd mysite
172-16-22-166:mysite manuelgomez$ ls
chocolate llama nuts story
db.sqlite3 manage.py polls urls.py
fts mysite settings.py
172-16-22-166:mysite manuelgomez$ python manage.py migrate
Operations to perform:
Apply all migrations: admin, contenttypes, auth, sessions
Running migrations:
No migrations to apply.
172-16-22-166:mysite manuelgomez$ python manage.py syncdb
Operations to perform:
Apply all migrations: admin, contenttypes, auth, sessions
Running migrations:
No migrations to apply.
172-16-22-166:mysite manuelgomez$ python manage.py makemigrations polls
App 'polls' could not be found. Is it in INSTALLED_APPS?
172-16-22-166:mysite manuelgomez$

最佳答案

在 settings.py 中,您会找到 INSTALLED_APPS 并且您必须添加投票,如下所示。

    INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'polls'
]

关于python - 错误 : App 'polls' could not be found. 是否在 INSTALLED_APPS 中? *但是 polls 在 settings.py 的 INSTALLED_APPS 中。我,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31838377/

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