问题
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?
回答1:
Maybe a dirty solution but if you really want to get rid of your sorl-thumbnail dependency you don't have much choice :
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
It should work unless you have DataMigrations depending on special features of sorl-thumbnail.
来源:https://stackoverflow.com/questions/15721021/how-to-deal-with-old-pip-requirement-in-django-south-migrations