当我尝试推送到 heroku 时,我的 Django 项目出现问题
I have a problem in my Django project when I try to push to heroku a problem occurs
django.db.utils.IntegrityError:关系“blog_post”的“固定”列包含空值
我在 localhost 和 Heroku 服务器上迁移并做了所有事情,但我不知道如何解决这个错误。
如果 blog__post 的列 'pinned' 是不可为空的字段,则您的数据库中有一个条目对于 'pinned' 为空。找到条目并为其赋值。
使用 heroku run python manage.py makemigrations
在 heroku 服务器上创建迁移,然后 运行 heroku run python manage.py migrate
更新数据库表。
django.db.utils.IntegrityError:关系“blog_post”的“固定”列包含空值
我在 localhost 和 Heroku 服务器上迁移并做了所有事情,但我不知道如何解决这个错误。
如果 blog__post 的列 'pinned' 是不可为空的字段,则您的数据库中有一个条目对于 'pinned' 为空。找到条目并为其赋值。
使用 heroku run python manage.py makemigrations
在 heroku 服务器上创建迁移,然后 运行 heroku run python manage.py migrate
更新数据库表。