小编rav*_*oli的帖子

Django 单元测试 - 无法创建 django_migrations 表

我正在尝试编写一些单元测试并使用它们运行它们,manage.py test但由于django_migrations某种原因脚本无法创建表。

这是完整的错误:

Creating test database for alias 'default'...
Traceback (most recent call last):
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\django\db\backends\utils.py", line 83, in _execute
    return self.cursor.execute(sql)
psycopg2.ProgrammingError: no schema has been selected to create in
LINE 1: CREATE TABLE "django_migrations" ("id" serial NOT NULL PRIMA...
                     ^


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\django\db\migrations\recorder.py", line 55, in ensure_schema
    editor.create_model(self.Migration)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\django\db\backends\base\schema.py", line 298, in …
Run Code Online (Sandbox Code Playgroud)

django postgresql django-unittest

6
推荐指数
4
解决办法
6347
查看次数

标签 统计

django ×1

django-unittest ×1

postgresql ×1