我正在尝试创建我的Django项目/网站的"民意调查"部分,而教程(https://docs.djangoproject.com/en/1.8/intro/tutorial01/)表示在我们"激活"我们拥有的模型之前在settings.py中的INSTALLED_APPS库中包含"民意调查".我做到了,然后我做 - > $ python manage.py进行迁移民意调查.这给了我错误 - >无法找到App'民意调查'.是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$
Run Code Online (Sandbox Code Playgroud)
小智 15
在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'
]
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
14533 次 |
| 最近记录: |