这是一个上传图片的简单代码,我得到了这种类型的错误
from django.db import models
from PIL import Image
class Products(models.Model):
name = models.CharField(max_length=100)
slug = models.SlugField()
description = models.CharField(max_length=500,blank=True,null=True)
image = models.ImageField(upload_to='product_photo',blank=True,null=True)
def __unicode__(self):
return self.name
error :
ProgrammingError at /admin/DESigning/products/add/
column "image" of relation "DESigning_products" does not exist
LINE 1: ...Signing_products" ("name", "slug", "description", "image") V..
答案 0 :(得分:1)
您可能需要启动一个新的Djano应用程序'python manage.py startapp appName',并在新的appName文件夹中创建models.py.然后尝试makemigrations并迁移。如果您没有指定的django应用程序,则您的“_____关系不存在”。可在以下网址找到:https://docs.djangoproject.com/en/1.9/intro/tutorial01/