django relation "accounts_user" does not exist

我的django项目

Subject
    accounts
    courses
        views.py
        tests
            test_models.py
    subject
    

test_models.py:

from django.core.urlresolvers import reverse

from django.test import TestCase

from .models import MultiSubject
from accounts.models import User

class DjanoRestFrameworkTests(TestCase):

    def setUp(self):
        part=Part.objects.get(pk=2)
        MultiSubject.get_or_create(part=part, number=1, title='多选题', description='多选题:水可以用来干什么?')

    def test_MultiSubject(self):
        title = MultiSubject.get(title='多选题')
        description = MultiSubject.get(description='多选题:水可以用来干什么?')
        self.assertEqual(
            title.get_title, "多选题 题目是: 多选题:谁可以用来干什么?"
        )

运行python manage.py test报错
django.db.utils.ProgrammingError: relation "accounts_user" does not exist

clipboard.png
但是数据库中
这个表是存在的

clipboard.png

python manage.py makemigrations和python manage.py miagrate都可以正常执行
请问是什么原因

阅读 6k
1 个回答

from accounts.models import User

accounts.models里有定义User模型么?

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题