【发布时间】:2015-03-23 16:15:11
【问题描述】:
from django.db import models
from imagekit.models import ImageSpecField
from imagekit.processors import ResizeToFill
类产品(models.Model):
class Meta():
db_table = 'tovar'
product_title = models.CharField(max_length=200)
product_img = models.ImageField(upload_to='images')
avatar = models.ImageField(upload_to='avatars')
avatar_thumbnail = ImageSpecField(source='avatar',processors=[ResizeToFill(100, 50)],format='JPEG',options={'quality': 60})
product_categories = models.ForeignKey(Category)
product_subcategories = models.ForeignKey(Subcategory)
product_description = models.TextField()
def __unicode__(self):
return self.product_title
profile = Product.objects.all()[0]
print(profile.avatar_thumbnail.url)
print(profile.avatar_thumbnail.width)
不工作 manage.py syncdb
错误:
django.db.utils.OperationalError: no such table: tovar
请救救我
【问题讨论】:
-
你试过 manage.py migrate 吗?
-
我删除了我的数据库。并且无法创建新的。我的 syncdb 命令告诉我“django.db.utils.OperationalError: no such table: tovar”。
-
所有对数据库的操作都告诉我错误:"django.db.utils.OperationalError: no such table: tovar"
-
你能把你的settings.py的数据库部分贴出来吗?
标签: python django django-imagekit syncdb