这是 South & 尝试设置新环境的问题。在我的所有应用程序上运行迁移时,我收到以下错误:
Traceback (most recent call last):
File "/Users/emilepetrone/Sites/tindie2/lib/python2.7/site-packages/south/migration/migrators.py", line 175, in _run_migration
migration_function()
File "/Users/emilepetrone/Sites/tindie2/lib/python2.7/site-packages/south/migration/migrators.py", line 57, in <lambda>
return (lambda: direction(orm))
File "/Users/emilepetrone/Sites/tindie2/tindie/tindie/apps/seller/migrations/0001_initial.py", line 26, in forwards
('comments', self.gf('mezzanine.generic.fields.CommentsField')(object_id_field='object_pk', to=orm['generic.ThreadedComment'])),
File "/Users/emilepetrone/Sites/tindie2/lib/python2.7/site-packages/south/db/generic.py", line 44, in _cache_clear
return func(self, table, *args, **opts)
File "/Users/emilepetrone/Sites/tindie2/lib/python2.7/site-packages/south/db/generic.py", line 343, in create_table
for field_name, field in fields
File "/Users/emilepetrone/Sites/tindie2/lib/python2.7/site-packages/south/db/generic.py", line 643, in column_sql
field = self._field_sanity(field)
File "/Users/emilepetrone/Sites/tindie2/lib/python2.7/site-packages/south/db/mysql.py", line 263, in _field_sanity
type = self._db_type_for_alter_column(field).lower()
AttributeError: 'NoneType' object has no attribute 'lower'
这似乎是我上一次架构迁移或我的 models.py 中的某个问题。
在我的模型中,该字段看起来像(并且在迁移之间没有改变):
from mezzanine.generic.fields import CommentsField
class MyClass(models.Model):
comments = CommentsField(verbose_name=_("Comments"))
从迁移:
'generic.threadedcomment': {
'Meta': {'ordering': "('submit_date',)", 'object_name': 'ThreadedComment', '_ormbases': ['comments.Comment']},
'by_author': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'comment_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['comments.Comment']", 'unique': 'True', 'primary_key': 'True'}),
'replied_to': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'comments'", 'null': 'True', 'to': "orm['generic.ThreadedComment']"})
},
我有点困惑,因为这个字段在迁移之间没有改变,而且夹层也没有改变。提前感谢您的想法。