测试Django Rest框架的问题
我正在尝试执行DJANGO REST框架文档中的测试。无论我要测试什么,它总是会出现相同的错误。
测试示例:
class TestRequestFactory(APITestCase):
def test_request(self):
factory = APIRequestFactory()
request = factory.post('/list_user/', json.dumps({'title': 'new idea'}), content_type='application/json')
我指的是我在许多地方都看过的错误
django.db.utils.ProgrammingError: relation "user" does not exist LINE
1: ...ted_by", "user"."created_ts", "user"."is_active" FROM "user"
,而解决方案一直相同,do manage.py迁移
manage.manage.py迁移 -假机器人零,我可以做所有的事情,但最终给出了相同的错误
I'm trying to perform the tests that are within the Django Rest Framework documentation. And it always gives the same error, regardless of what I'm testing.
Test example:
class TestRequestFactory(APITestCase):
def test_request(self):
factory = APIRequestFactory()
request = factory.post('/list_user/', json.dumps({'title': 'new idea'}), content_type='application/json')
The error I'm referring to is this
django.db.utils.ProgrammingError: relation "user" does not exist LINE
1: ...ted_by", "user"."created_ts", "user"."is_active" FROM "user"
I've looked in many places and the solution has always been the same, do manage.py migrate
or manage.py migrate --fake bots zero
, I can do everything, but in the end it gives the same error
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论