我正在嘗試在添加到我的項目中的新應(yīng)用中創(chuàng)建新表..makemigrations效果很好,但是migrate不起作用..這是我的模型博客/models.pyfrom django.db import models# Create your models here.from fostania_web_app.models import UserModelclass Tag(models.Model): tag_name = models.CharField(max_length=250) def __str__(self): return self.tag_nameclass BlogPost(models.Model): post_title = models.CharField(max_length=250) post_message = models.CharField(max_length=2000) post_author = models.ForeignKey(UserModel, on_delete=models.PROTECT) post_image = models.ImageField(upload_to='documents/%Y/%m/%d', null=False, blank=False) post_tag = models.ForeignKey(Tag, on_delete=models.PROTECT) post_created_at = models.DateTimeField(auto_now=True)當(dāng)我嘗試執(zhí)行python manage.py migrate此操作時出現(xiàn)此錯誤invalid literal for int() with base 10: '??????? ???????'UserModel是在同一項目的另一個應(yīng)用程序中創(chuàng)建的,這就是我使用該語句的原因from fostania_web_app.models import UserModel
1 回答

青春有我
TA貢獻1784條經(jīng)驗 獲得超8個贊
錯誤信息: ValueError: invalid literal for int() with base 10: '??? ??? ?????'
根據(jù)例外,以10為底的int():'??? ??? ?????'
不符合int的資格。簽入blog.0001_initial
遷移,'??? ??? ?????'
并使用有效的int修改該值。
在重新運行不是int()的makemigrations命令時,您可能不小心提供了垃圾默認(rèn)值。
添加回答
舉報
0/150
提交
取消