错误:找不到应用程序“民意调查".它在INSTALLED_APPS中吗?*但是民意调查位于settings.py中的INSTALLED_APPS中.一世 [英] error: App 'polls' could not be found. Is it in INSTALLED_APPS? *But polls is in INSTALLED_APPS in settings.py. I

查看:22
本文介绍了错误:找不到应用程序“民意调查".它在INSTALLED_APPS中吗?*但是民意调查位于settings.py中的INSTALLED_APPS中.一世的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建Django项目/网站和教程的投票"部分( $ python manage.py进行迁移民意测验.这给了我错误->找不到应用程序"polls".是在INSTALLED_APPS中吗?我从这里做什么?添加民意调查后,我同步了数据库,但仍然无法正常工作.

I am trying to create the 'polls' part of my Django project/website and the tutorial (https://docs.djangoproject.com/en/1.8/intro/tutorial01/) says that before we 'activate' the models we have to include 'polls' in the INSTALLED_APPS library in settings.py. I did that, then I do--> $ python manage.py make migrations polls. This gives me the error--> App 'polls' could not be found. is it in INSTALLED_APPS?. What do I do from here?! I synced my database after I added polls, still doesn't work.

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,并且必须如下所示添加民意调查.

In settings.py you will find INSTALLED_APPS and you must add the polls as shown below.

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

这篇关于错误:找不到应用程序“民意调查".它在INSTALLED_APPS中吗?*但是民意调查位于settings.py中的INSTALLED_APPS中.一世的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆