我意外丢弃了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
答案 0 :(得分:-1)
首先同步您的项目: 像这样:
python manage.py syncdb
完成后,您可以投放:python manage.py makemigrations
和上次python manage.py migrate