【发布时间】:2015-10-28 13:48:51
【问题描述】:
我正在尝试创建我的 Django 项目/网站的“投票”部分,教程 (https://docs.djangoproject.com/en/1.8/intro/tutorial01/) 说,在我们“激活”模型之前,我们必须在设置中的 INSTALLED_APPS 库中包含“投票”。 py。我这样做了,然后我做了--> $ python manage.py 进行迁移民意调查。这给了我错误->找不到应用程序“民意调查”。它在 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$
【问题讨论】:
-
您是否创建了该应用程序? python manage.py startapp polls ?
-
请添加您的
settings和polls的目录结构。