How to deal with old pip requirement in Django South migrations?

落爺英雄遲暮 提交于 2019-12-08 02:52:03

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!