问题描述
我有一个与South一起管理了很长时间的应用程序。在开发的某一时刻,我向具有pip要求(sorl-thumbnail)的模型添加了一个自定义字段,但后来删除了此要求。我的问题是,当我尝试在一个新的新数据库中迁移此应用程序时,南喊:
I have an app which is managed with South for quite a while. At one point of the development, I added a custom field to a model that had a pip requirement (sorl-thumbnail), but I removed this requirement later. My problem is that when I try to migrate this app in a fresh new database, South shouts:
./manage.py migrate my_app
...
ValueError: Cannot import the required field 'sorl.thumbnail.fields.ImageField'
我应该如何处理这个旧要求?
How am I suppose to deal with this old requirement?
推荐答案
也许是一个肮脏的解决方案,但是如果您真的想摆脱您的soul-thumbnail依赖性,您没有太多选择:
Maybe a dirty solution but if you really want to get rid of your sorl-thumbnail dependency you don't have much choice :
找到添加了该字段的迁移文件并替换 sorl.thumbnail.fields.ImageField
,例如 django.db.models.fields.files.ImageField
Locate the migration file in which the field was added and replace sorl.thumbnail.fields.ImageField
by something like django.db.models.fields.files.ImageField
除非您具有取决于sorl-thumbnail的特殊功能。
It should work unless you have DataMigrations depending on special features of sorl-thumbnail.
这篇关于如何处理Django South迁移中的旧点要求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!