【发布时间】:2016-08-17 22:06:06
【问题描述】:
我不小心删除了我的 Postgres 数据库。然后按照this solution我删除了迁移文件,但现在无法执行第三步的命令“python manage.py migrate --fake”。
RuntimeError: Error creating new content types.
Please make sure contenttypes is migrated before trying to migrate apps individually.
psycopg2.ProgrammingError: relation "django_content_type" does not exist
LINE 1: ..."."app_label", "django_content_type"."model" FROM "django_co...
^
我尝试运行“python manage.py migrate contenttypes”和“python manage.py makemigrations contenttypes --empty”,但都不起作用。
使用 django 1.9.5
【问题讨论】:
-
你必须先运行syncdb!
-
@rakwouen:不是在 Django 1.9.5 上,他们没有。
syncdb在 1.9 中消失了,它的manage.py migrate取代了它。见"Unknown command syncdb" running "python manage.py syncdb"
标签: django postgresql