当我尝试通过编写以下代码来迁移django应用程序模型时:
python manage.py makemigrations
然后引发ValueError:尝试相对导入超出顶级包
这是我的项目屏幕截图:
这是我的模型。py
from django.db import models
from ..krisi_user.models import krisi_user
#from src.krisi_user.models import krisi_user
# Creating krisi_user_image Model
class problem_image(models.Model):
full_name = models.CharField(max_length=250)
email = models.CharField(max_length=100)
image = models.ImageField(upload_to='images')
phone = models.CharField(max_length=50)
krisi_user = models.ForeignKey(krisi_user,on_delete= models.CASCADE)
def __str__(self):
return self.full_name